# Increase variable with the next number (in a column)

Hi everyone!

I have a problem and maybe someone has an idea that can solve it. I will try to be the clearest possible so first I will explain the situation.

I’m working in an excel spreadsheet and if 2 or more rows have the same ID I need to add all the values that are associated with each row, and then copy the ID with the result of that “sum” in another spreadsheet.

For example:

ID Value

7726638 1465,2

7726638 6660

7726638 -0,2

7726638 21239,49

7726638 1044,56

So, the final result should be:

ID Value

7726638 30409,05

I have a loop that compares each ID and when it finds an ID that repeats at least once uses if conditions to go to the value and copies it to a variable, then goes to the next value and it should add this value to the previous one. The problems is that I´ve tried to use the expression \${suma_entered}+\${suma_entered} putting the result in the same variable \${suma_entered}, I mean, increasing the variable suma_entered with the next number in the list. But it’s not working properly. Maybe my logic isn´t the right one.

I´ve tried a little script just to try this logic, with a repeat loop, is the one that I share here. Please have in mind I use a while loop in the original script because I will not be able to know if an ID repeats and if so, how many times. But I believe if I understand what I am doing wrong here, I will be able to solve all of it.

I apologize for any grammatical error I may had.

Captura|690x153

Hi @mikavm can you share your recording to have a look?

1 Like

Hi @ashapkina thank you for the reply. I had to change the script because I couldn´t find a way to increase the variable as I wanted. But, if someone needs to know, now I use the formula in excel “CONCATENAR(num1;num2;…numn)” to compare the IDs, and the other variables. If they repeat the bot copies all the rows with the same ID, and do the sum in an auxiliar spreadsheet, and then puts the result in the spreadsheet that I really need.

1 Like

Glad you found a solution @mikavm
Thanks for sharing