1
votes

I'm using Epplus to put a formula into a cell. If I put this formula manually into the Excel cell it works:

=SUM(E4;G4)

But when I put in code with Epplus it doesn't work:

xls.ActiveSheet.Cells(8, 4).Formula = "SUM(E4;G4)"

Is there something special needed when I SUM two cells? If I do the same with a range of cells it works, but with specific cells not.

This works (Range):

xls.ActiveSheet.Cells(8, 4).Formula = "SUM(E4:G4)"
1
doesn't work is not specific. You need to tell us, what's not working. Is it showing the value instead of making the calculation? - jAC
You are using Dutch or some other international version. You might want to try the English notation: sum(e4,g4) - Guido Leenders
That formula does not work for me in Excel, I have to use =SUM(E4,G4) Guido might be right, you might have different notation. - the_lotus

1 Answers

2
votes

Try changing this

xls.ActiveSheet.Cells(8, 4).Formula = "SUM(E4;G4)";

into

xls.ActiveSheet.Cells(8, 4).Formula = "SUM(E4,G4)";

Somehow using ; in a formula messes things up. Could be a bug...