# Update a variable in a loop

**URL:** https://community.make.com/t/update-a-variable-in-a-loop/88310
**Category:** Questions
**Tags:** arrays
**Created:** [July 29, 2025, 11:59am UTC](https://community.make.com/t/update-a-variable-in-a-loop/88310 "2025-07-29T11:59:10Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Baboune](https://avatars.discourse-cdn.com/v4/letter/b/6f9a4e/32.png) [@Baboune](https://community.make.com/u/Baboune)
#### Post date: [July 29, 2025, 11:59am UTC](https://community.make.com/t/update-a-variable-in-a-loop/88310/1 "2025-07-29T11:59:10Z")

</div>

Hello everyone, I hope you are all doing good!  
I have a scenario wherein I have a router with 2 branches for conditions and a last one that serves as a converger.  
In the two condition branches, I need to keep track of the OpenAI’s API cost. As of now, I use an array aggregator to store every cost, but when the loop ends, I need to retrieve these arrays in the last branch (converger) to sum them. Does anyone know how this can be done ?  
Here is a picture of what the scenario looks like:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/1/a/1a265303baee3e8b163d4717d062de1f3fa2f90c.png)  
Thanks in advance for your help.

---

<div class="post-metadata">

### Author: ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)
#### Post date: [July 31, 2025, 3:38pm UTC](https://community.make.com/t/update-a-variable-in-a-loop/88310/2 "2025-07-31T15:38:12Z")

</div>

To “update” a variable, you basically need to get the variable’s current value first.

To do this, you can try using the Tools “ **Get multiple variables** ” module —

> Get values of a previously stored variables.

For more information about the Get multiple variables module and Tools app, see the corresponding [Integrations page](https://www.make.com/en/integrations/util) and the [Help Centre documentation](https://apps.make.com/util).

Hope this helps! Let me know if there are any further questions or issues.

— @samliew

---

<div class="post-metadata">

### Author: ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)
#### Post date: [October 29, 2025, 4:42pm UTC](https://community.make.com/t/update-a-variable-in-a-loop/88310/3 "2025-10-29T16:42:13Z")

</div>


