Add up the value from different rows having the same ID in an excel table

Hello there,I am dealing with a table but encountered with some problems.
I have a table with 22 rows and 7 colum.
I used to use sumif Function in excel to get the total cost of one ID and write the sum to a cell in the same table.
1 2 3 4 …
no1 id1 cost1 discount1
no2 id1 cost2 discount2
no3 id2 cost1 discount1

disirable output is sum,eg:
id1 sum=cost1+cost2+discount1+discount2
id2 sum=cost1+discount1

my approach was:
Excel application scope
Read range
for each row
get row item

then I got stucked.
I could get the ID of the row, but I need to compare the ID with the ID of next row…
if the current ID is the same as the next ID I need to add up the cost and discount…

I would be really grateful if anyone could give me some advice on this…Thanks!!!

1 Like