Question Setting formula in excel file including %

heckl

New member
Joined
Oct 14, 2016
Messages
1
Programming Experience
5-10
You can set formula like this in an excel file using c#:
Worksheets("Sheet1").Range("A1").Formula = "=$A$4+$A$10";
If the formula contains '%' then an error occurs!!! (a table column name contains %) How can you use % in formula?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,813
Location
Sydney, Australia
Programming Experience
10+
I'm no Excel guru so there may be other options but I think you should be able to use CHAR(37) to generate a % character from its ASCII code. You should be able to concatenate that to the rest of the formula with an & operator.
 
Top Bottom