How to get the sum For each row?

Hello,

I am trying to tally the amount in column “F”, I have made F11 the variable and made it count 1 down to get the SUM of the rest the amounts. I do not know how to stop the (For Each Row Process) until the next variable which is F19. The variables are assigned by looking for a contain in the alphabet in Account Column “D”.

Thank you

1 Like

Hi @kieranwong

you can use datatable functions

dataTable.AsEnumerable().Sum(Function(row) row.Field(Of Decimal)(“Amount”))

cheers :smiley:

Happy learning :smiley:

5 Likes

Thanks

1 Like

No worries @kieranwong happy to help

cheers :smiley:

Happy learning :smiley:

4 Likes

Hello @kieranwong

Another option is to use the component here

https://go.uipath.com/component/datatable-plugins

Use the data table consolidate activity in this component. How to use is also provided under resource

1 Like

Sorry to bother you again, the image below is the Uipath code that I have scripted.

Thanks

(Part 2)
For your code that you sent me, it calculate the whole column. However I only want to calculate a range of rows.

For my case, I would want to calculate the amount in the whole yellow region and then for the next variable calculate the sum in the green region. If the amount = 0 then I should return a “True” message box. I do not know how to code this can I get some help from you?

Thanks again!

where is your output?