How to sum the row data

excel
studio

#1


in this i want to sum the row data i don’t want to use the loop to add it is their any function are their to sum the row data .


#2

any one .


#3

@akshaygm12 if it is present in excel we can add.


#4

Check if this helps out ,

DataTable1.Columns.Add(“TotalVal”, typeof(Double));
DataTable1.Columns[“TotalVal”].Expression = “C1+D1+E1”;

Create a new column , which would be based on a expression , and in the expression formula , give in the column names …

maybe try something like this …

its very crude , and can be structured better ,

image


#5

@akshaygm12

You first Read your Excel and store it in a DataTable dta

Then the Sum of each row will be stored in a List , Let us take List A

List A= (From p In dta.Select
            Select(Convert.ToString(p.ItemArray.Sum(Function(x) If(IsNumeric(x), Convert.ToDouble(x),0))))).ToList

List A will Contain Sum of Each Row.

I have not tested the code, Please try this.

Regards,
Mahesh


#6

thanks its working. :slight_smile: