I had a two excel files, I need to sum according to the column name in which is having both Negative values and postive values. For Eample like this:
if have used below query using linq :dt.AsEnumerable.Sum(Function(x) If(IsNumeric(x(“Column2”).ToString.Trim),CDbl(x(“Column2”).ToString.Trim),0))
I am getting error like this:
I try to convert to int but i getting error like input string was not in correct format
please help me out for solution
Thanks in advance.
provide the sample excel file with input and output clearly mentioned.
Thanks for Replying.
Sum.xlsx (9.6 KB)
Please find the attached sheet.
I have to sum the column B in sheet 1 and column D in Sheet2.
And I have to verify sum of column B = sum of column D or Not.
Thanks in Advance,
dt.AsEnumerable.Sum(Function (x) If(x(1).ToString.Replace(" ","").IsNumeric, CDbl(x(1).ToString.Replace(" ", "")), 0 ))
Thanks a lot Varun, its worked for me.
Can we use this for Pivot Table column?
How do you want to use it in pivot table?
I was attached sheet1 right, Sheet1 was pivot table and sheet 2 was normal excel
My requirment was, i have to check sheet1 column2 sum and sheet 2 columnn10
was having same or not.
can you please help me how can i get this.
Thanks in advance,
There is no Column10 in the sheet you provided.
Thanks varun for replying, i got the solution.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.