Skip to main content linkedinfacebooktwittermenuarrow-up
0

Support decimals in SUMIF function Duplicate

Hello!
The SUMIF functions seems to work well when working with ints and doubles, but not with decimals. Example:

ExcelFile ef = new ExcelFile();
ExcelWorksheet ws = ef.Worksheets.Add("Formula");

// this would work with integer or double values here
ws.Cells["A1"].Value = 300.15M;
ws.Cells["A2"].Value = 200.20M;
ws.Cells["B1"].Value = true;
ws.Cells["B2"].Value = false;

ws.Cells["C1"].Formula = "=SUMIF(B:B,TRUE,A:A)";

ws.Calculate();

// should print 300
Console.WriteLine(ws.Cells["C1"].StringValue);

It would be great if this would work also with decimals. I'm mostly using decimals for my calculations and everything else seems to work well, besides SUMIF function. For example, SUM works well.

Thanks,
Kamil