How can I sum a certain excel column depending on a filter? I need a Linq query for this. For example, suppose I have a column named “STATUS” that has “ERROR” and “DONE” values, and a second column that contains some integer values. I want to filter on the status column with the value “DONE” and add the second column
This query filters the rows in the DataTable where the STATUS column has the value “DONE”, converts the values in the Column2 column of these rows to double, and then calculates the sum of these double values.
(From row In dt_input.AsEnumerable() Where row("STATUS").ToString() ="DONE" Select Cdbl(row("Column2"))).Sum()