How to sum specific columns in excel

total_sum.xlsx (8.8 KB)
i have one file i want to Calculate totals for columns E,H,J,K,L
Remove all rows except the first row (header) and the totals row
save in a excel.
thanks in advance.

Kindly have a view on this thread for insights on this case

Cheers @MOHIT_MANGAL

1 Like

@MOHIT_MANGAL,

Declare an integer datatype variable named as intSum
I assume you have a datatable named as yourDataTable

Then in a assing activity place the below query, this is a linq query.

intSum = yourDataTable.AsEnumerable.Sum(Function(x) If(IsNumeric(x(columnindex).ToString.Trim),CDbl(x(columnindex).ToString.Trim),0))

Hi @MOHIT_MANGAL
Use remove data column and use read range

int MaxValue=Convert.ToInt32(dt.AsEnumerable().Sum(Function(row) row(“Column5”)))

Thanks
Ashwin S

i don’t want to use balareva activity.can you tell in another way

can you upload with my excel sheet as a sample data.

@MOHIT_MANGAL,

Done, Check this one.
ExcelCalcTotal.xaml (5.7 KB)

1 Like

its working fine for j,k,l column but what about E,H column when i use same method which you use in write cell only i replace j to E …it is not getting perfect value its write 183 for E,H column…
how to do for E,H column…?
and after getting values how to Remove all rows except the first row (header) and the totals row
save in a excel.
thankyou in advance

@MOHIT_MANGAL,

You have to change the column name highlighted in the query for E and H Column,

Change it both the places in the query.

1 Like

thankyou soo much for your time i really appreciate and thankyou for solving my doubt…

thankyou for your help…i got the solution

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