Sum of All Columns in a Row in Export to Excel Application


I have already made export to excel report.
In which now i want sum all the columns in a particular row at last line.
how can i do this?

Please help me in solving this


Create decimal variabl and add each value while exporting to excel…

Just add a formula in the cell where you need it.

Lets say in the excel sheet you have a column of numbers in column “G”, you have a header in the first row, and then you have 6 lines of data, then in cell G8 you enter =SUM(G2:G7)

the G you known and the 2 you know, so those are constants, to get the 7 just count the number of rows you create in Navision, so the formula will look something like

StartRow := CurrentRow;
EndRow := CurrentRow - 1;
ExcelSheet.Formula := STRSUBSTNO(’=SUM(G%1:G%2)’,StartRow,EndRow);

Thank U very mush David,

I could not get answer here. Let me explain through an example

Integer Decimal

1 10

2 -20

3 30

4 -40

5 50

…(I want total to be printed here)

I can do this directly from table level but my problem in table i will be having only +ve values. So at report export to excel level i wrote a code in order to both +ve & -ve(Credit Memo Values). Now i want to print the total of this Decimal column in the excel sheet.

Thank U

Did you try with Global Decimal variable?

You can keepon add values to it and export new line with that value…

Hello Mohana,

If i take values from the table all will be +ve values. So when i export this to excel sheet i will be getting both +ve & -ve.

I am generating report from TDS Entry table. In this i am taking TDS Base Amount field. All the values for this field will be in +ve sign.(i.e both Document Type of Invoice& Credit Memo). So in export to excel level i wrote code in order to -ve sign for credit memo. So now i want total of this TDS Base Amount feild.

Thank U