This project has moved and is read-only. For the latest updates, please go here.

Excel operators (average, variance)

Jan 27, 2012 at 12:22 PM

Can I use excel operators as averande and variance with ClosedXML?

Jan 27, 2012 at 4:28 PM

There is no AVERANDE function in excel and to get the variance you must use one of the VAR functions. If you meant to get the average you have to use one of the AVERAGE functions. You have to input the formulas the same way you would type them in Excel.

See Using Formulas and Using Tables

Jan 28, 2012 at 7:55 AM

Thanks for the answer, I'm sorry for the mistake.

However I tried to input the formulas the same way you would type them in Excel but  in excel cell appears

#NOME?

When I click on the cell appears the correct formula. Where am I doing wrong?

Thanks for your time

Ruggiero


Jan 28, 2012 at 4:07 PM

Try the following:

            var wb = new XLWorkbook();
            var ws = wb.Worksheets.Add("Sheet1");

            ws.Cell(1, 1).SetValue(1)
                .CellBelow().SetValue(2)
                .CellBelow().SetValue(3)
                .CellBelow().FormulaA1 = "=AVERAGE(A1:A3)";

            wb.SaveAs("Example.xlsx");

Jan 28, 2012 at 4:42 PM

I realized the error. I was writing the operator in Italian (e.g.  "= MEDIA (...)")

thank you very much

Ruggiero