Writing formula in excel

Hi Team,

I wanted to write formula in 100 columns of excel. I am writing the below formula - “=SUM(”“A”+ CellCounter.ToString +“B”+CellCounter.ToString)“” but it is giving the error like end of exxpression required.

The formula should written c1,c2,c3…c100 Cell of excel. The CellCounter is int variable whose value increasing each time in foreach look.
Please help .

Regards,
Shirish

Whenever there is a double quote within the string, you’ll have to add an additional double quote around it

"=SUM(""A""+ CellCounter.ToString +""B""+CellCounter.ToString)"

This has removed the error but it is writing formula in excel and giving the proper result. Actually, It should type C2= A2 + B2 and result should be in cell but is not giving.

In cell , it is #VALUE! giving like this.

Please reply

The value for CellCounter.ToString is not getting evaluvated which is the problem. We have addedd the double quotes around variable A WHICH CAUSING THIS issue.

Try this code
=SUM("A"+ CellCounter.ToString+",B"+CellCounter.ToString)

CellCounter data type is integer right?

upload your xmal file, so we can give the correct solution

Regards,
Arivu

Yes, Cell Counter is of type int. When I have netered the below statement provided by u then t is saying end of statement needs.

"=SUM(A"+ CellCounter.ToString+",B"+CellCounter.ToString+")"

try this

"=SUM(A"+ CellCounter.ToString+",B"+CellCounter.ToString+")"
Can you check the xaml file, its working fine.

Flowchart.xaml (7.3 KB)
New Microsoft Excel Worksheet.xlsx (8.4 KB)

Regards,
Arivu

2 Likes

Thanks it is working. How i can copy excel columns or rows from in sheet.

1 Like

Thanks a lot. It is working fine.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.