How to add values of 4 successive elements of a column?

I have a CSV file where there are two columns inside it and I need to add first 4 rows of a column and then proceed to next 4 rows and add them and so on. How can I implement this task?

and what activities should I use?


listOfString = dt .Rows.cast(of datarow). select (function(dr) dr(“column name”).tostring).tolist

This piece of code will extract the column as list

sum = list.sum

Thank you for your help. But, its not working.


Here i have attached code sample containing the logic i am proposing.
Look into it and ask if there is any query. (8.5 KB)

@ Raghu9060

Thank you for explaining it more briefly. The one which you have given adds all the numbers and displays the result. But, I want to add the first 4 values of the excel file and store it in another field and next 4 of them together and so on.


Below attached is a mock solution for a query, is not as impressive. But it will solve your query for now.

Be posted I will try finding more optimized (8.9 KB)


If the solution is working, mark as solution.