# How to sum variables in a repeat loop outside of the loop

**URL:** <https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404>\
**Category:** Support\
**Tags:** form-design\
**Created:** [August 13, 2017, 12:49pm UTC](https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404 "2017-08-13T12:49:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qudrat\_azimy](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/q/f6c823/32.png) [@Qudrat\_azimy](https://forum.getodk.org/u/Qudrat_azimy)\
**Post date:** [August 13, 2017, 12:49pm UTC](https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404/1 "2017-08-13T12:49:00Z")

</div>

Hi,  
I have added a repeat to record quantity and price of sells. now out of the loop using another variable, I want to sum the sells recorded in the repeat loop. how can this be done?

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [August 14, 2017, 1:30am UTC](https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404/2 "2017-08-14T01:30:28Z")

</div>

I believe [this post](https://forum.getodk.org/t/calculations-across-repeats/2815/2) will give you the answer you're looking for.

Welcome to the ODK forum! In the future, please do make sure to search for your question to see if an answer already exists.

---

<div class="post-metadata">

**Author:** ![Qudrat\_azimy](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/q/f6c823/32.png) [@Qudrat\_azimy](https://forum.getodk.org/u/Qudrat_azimy)\
**Post date:** [August 14, 2017, 3:44am UTC](https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404/3 "2017-08-14T03:44:52Z")

</div>

Thanks a lot Helen. I will try it.

---

<div class="post-metadata">

**Author:** ![LN](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ln/32/1605_2.png) [@LN](https://forum.getodk.org/u/LN)\
**Post date:** [March 19, 2020, 8:58pm UTC](https://forum.getodk.org/t/how-to-sum-variables-in-a-repeat-loop-outside-of-the-loop/9404/5 "2020-03-19T20:58:24Z")

</div>

@Joaquin_Linares can you please share what you tried and what result you got?
