Sum of column of a datatable

Hello,

I’m having a problem with the sum of columns in a datatable.

I’m having an excel like this testexcel.xlsx (12.1 KB)

Here you can see in sheet1 my datatable. In sheet 2 you can see what it has to be.

I need to make a sum of column B, but only from row 3 till 6. I can do a remove data row for the first two rows but then i want to do an assign like this → datatable.AsEnumerable.Sum(Function(x) Convert.ToInt32(x(“Column name”).ToString.Trim) ).ToString

When i execute this i got an error: Assign : Input string was not in a correct format."

Does someone knows what i’m doing wrong?

Hi @hansgeeroms,

May it help you

Regards
Balamurugan.S