# How to sum numers from a list?

**URL:** <https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583>\
**Category:** Questions about Thunkable X\
**Created:** [June 18, 2019, 5:58pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583 "2019-06-18T17:58:53Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 20, 2019, 3:43pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/21 "2019-06-20T15:43:55Z")

</div>

Hi, Kartik! 🙋‍♂️

I try this in “[https://x.thunkable.com/projects/5d0ba79be8e428bff10b460e/b35d424e-a0da-4130-82c6-2c38d6725876/designer](https://x.thunkable.com/projects/5d0ba79be8e428bff10b460e/b35d424e-a0da-4130-82c6-2c38d6725876/designer)”  
But i dont know if i do this correctly… but nothing happens 😓  
Sorry =/  
I probably did something wrong.

---

<div class="post-metadata">

**Author:** ![kartik\_old](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik_old/32/28305_2.png) [@kartik\_old](https://community.thunkable.com/u/kartik_old)\
**Post date:** [June 20, 2019, 4:33pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/22 "2019-06-20T16:33:46Z")

</div>

You may try now :  
[https://x.thunkable.com/copy/908b171baa227a38c6c535f7a667d739](https://x.thunkable.com/copy/908b171baa227a38c6c535f7a667d739)

Make sure you read the comments.

Thanks! 😉

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [June 20, 2019, 4:40pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/23 "2019-06-20T16:40:10Z")

</div>

The “sum of list” block works like this. If the list contains only values ​​of the numeric type, then they will be summed up. If in the list there is at least one element of string type, then the operation of joining strings will be performed, as if all elements of the list are strings.

To sum up the string values ​​of numbers, you need to use a loop through the list with the conversion of string type numbers to numbers.

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/3/c3b8b02fc8c81fc7204d7bdfb5f73622eb3bc164.png)

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 20, 2019, 9:26pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/24 "2019-06-20T21:26:52Z")

</div>

Thanks for helping me actech and kartik…

I just try use and i have a question… when i put de numbers ? because i think this blocks its only to list i create and can’t put numbers…  
sorry, i am a very very beginner in thunkable =/

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 20, 2019, 9:56pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/25 "2019-06-20T21:56:42Z")

</div>

Those “Text\_Input” components is where you can enter numbers. Once they are in (accessible as “Text\_Input get text”) you can copy the content to be an element in a list, or anything else you wish. I have an app where what you enter is interpreted as the colour of another component, so you have complete freedom, as long as you are consistent with the variable type and content.  
In actech’s example, he put the values in a List\_Viewer only to demonstrate a list that is broken down from a coma delimited string; it could have been a list that is stand alone, i.e. that is not a component in a layout.

Again, you have freedom. The art of programming is making the most effect out of the least code.

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 21, 2019, 4:16am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/26 "2019-06-21T04:16:26Z")

</div>

Hmmm i know it… the art of programming… but i don’t have the knowledge to do this… many years maybe i will have hahahaha =)

but i will try this codes to see… but its easier to me have a example than only see codes… 😓

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 21, 2019, 7:44am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/27 "2019-06-21T07:44:09Z")

</div>

Hi CBVG

I try create your label from my app here: [How to sum numers from a list? - #16 by db82203608aa4b](http://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/16)

but I did not find “roundtoplaces”

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/6/260a0b764107a30fe34a6cae8a383f4a0a0c324b.png)

=(

---

<div class="post-metadata">

**Author:** ![kartik\_old](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik_old/32/28305_2.png) [@kartik\_old](https://community.thunkable.com/u/kartik_old)\
**Post date:** [June 21, 2019, 8:05am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/28 "2019-06-21T08:05:38Z")

</div>

Hello Again!

I have used the round block here in this project :  
[https://x.thunkable.com/copy/ef01d001e7ae4e28efba0e9863d27790](https://x.thunkable.com/copy/ef01d001e7ae4e28efba0e9863d27790)

Hope it helps! 😉

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 21, 2019, 9:29am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/29 "2019-06-21T09:29:31Z")

</div>

Perhaps that is because it is a procedure _I_ wrote, and that you can copy?

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 24, 2019, 7:50pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/30 "2019-06-24T19:50:11Z")

</div>

Hi again CBVG

Before anything, thanks so much for help me… and sorry for my fault of knowledge

I copy your code on my app like this but not are showing only 2 decimals

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/d/cda012d8a94381c6dc382369f8c168afb7ac6551.png)

you can see here my project:  
[https://x.thunkable.com/projects/5d03d3be26b1a063839f8b30/dc2b7f4b-b246-4231-a757-40c730dec8b4/designer](https://x.thunkable.com/projects/5d03d3be26b1a063839f8b30/dc2b7f4b-b246-4231-a757-40c730dec8b4/designer)  
[https://x.thunkable.com/projects/5d03d3be26b1a063839f8b30/dc2b7f4b-b246-4231-a757-40c730dec8b4/blocks](https://x.thunkable.com/projects/5d03d3be26b1a063839f8b30/dc2b7f4b-b246-4231-a757-40c730dec8b4/blocks)

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [June 25, 2019, 1:02am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/31 "2019-06-25T01:02:00Z")

</div>

You sort of have to _CALL_ roundToPlace.  
Right now, it is just there looking pretty, but not being put in action.

Each of those statements in Timer1.fires HAS to include the call to roundToPlaces.

Draw inspiration from the MOCK “do something” that was just put there as a demo.  
Each line has to read something like this (only one line shown)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/6/46822772dace250a9f7244bbdd2f8a7c844073c2.png)

And in fact, since the Total\_Payout and Total\_Stack are ALWAYS the same, you can even make it simpler by having only one complicated equation that uses the only variable as input, and call that function (which in turns calls the function roundToPlace) instead (again only one Label\_#n\_CC shown):

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/3/d3b88b8e858c799ffddc47f43e9e12b921353dc5.png)

---

<div class="post-metadata">

**Author:** ![Yukold](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/yukold/32/35122_2.png) [@Yukold](https://community.thunkable.com/u/Yukold)\
**Post date:** [June 25, 2019, 4:26pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/33 "2019-06-25T16:26:17Z")

</div>

YESSSSSSSSS!!!  
I do it and now are all fine ;D

Thanks so much CBVG!!!  
Hope i finish column 4 with no problems now 🙂  
Thanks thanks thanks 😃

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:13pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/34 "2024-11-08T12:13:14Z")

</div>



[Previous page](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583.md?page=1)
