Problem with formula

Dec 10, 2010 at 12:30 PM

Hi!

 

I'm trying to use the VLOOKUP formula in a cell but when I generate the file, I get an error saying that "Excel found content that can't be read..." and when I click to open the file anyway, the formula in the cell is removed. My code looks like this:

 ws.Cells[27, 3].Formula = "VLOOKUP(C26;F3:H7;3)";

Other simple formulas (like "B6*C2") works fine. Since I'm using the Swedish version of Excel I have also tried to use "LETARAD" instead of "VLOOKUP", but no success. If I have the formula in the template file, everything works, but the lookup fields might be of different size from time to time, so I want to add it in the code-behind so I can set correct cells base on the size. Am I doing something wrong or is it EPPlus that can't handle this formula?

Regards

Jonas

Coordinator
Dec 10, 2010 at 1:43 PM
Hi,

You have to use commas(,) as separator for the parameters like this...

ws.Cells[27, 3].Formula = "VLOOKUP(C26,F3:H7,3)";
; is a swedish region setting.
Check out the section about formulas and styling in the FAQ.
Trevlig helg
Jan