# 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:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 18, 2019, 5:58pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/1 "2019-06-18T17:58:53Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/b/1b8a3ed7a9d130daa5e2c6f6237b4b6f30a52cbf.jpeg)

Hi guys, my question is simple but my problem is still big for me !!  
I will explain exactly what I need now  
In the first column, I need to sum all of them and show in the last label … (all column’s need this, but if i learn how to in one, will can do in others i think)

---

<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 18, 2019, 6:19pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/2 "2019-06-18T18:19:28Z")

</div>

You mean something like this:

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

?

(Of course, here, “mylist” can be a sub-list, or a column of your table, depending how you encoded it)

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 18, 2019, 7:53pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/3 "2019-06-18T19:53:17Z")

</div>

Sorry i dont understand…

I will give a example…

If i write 500 in #1, 4000 in #2 and 9000 #3 the last label will return 13500…

(the #1-#9 is just hint"s)

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 18, 2019, 7:54pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/4 "2019-06-18T19:54:11Z")

</div>

like this screen

is only sums…

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/8/082aa8b9df040a36aa3d0cc3d72500bb030d6a21.jpeg)

---

<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 18, 2019, 8:22pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/5 "2019-06-18T20:22:28Z")

</div>

The answer depends on how your list is organized.

Is this a list or a spreadsheet?

In your example, 500 is referred as what? Element 1 of a list of 9 that includes (500,1500,5000 … and 3 “undefined”) ?

The problem is not how to do thing, the problem is determining how things are saved now, THAT decides how to go about processing it.

So what do you have? What am I looking at? A bunch of 36 separate entities? 4 lists (column) of 9 elements each? One list of 4 lists of 9 elements?  
Are you expecting to leave those #7, #8 place holders there, or would an empty field be left blank?  
What about the 4th column?

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 18, 2019, 11:30pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/6 "2019-06-18T23:30:19Z")

</div>

> [@CBVG](#):
>
> The answer depends on how your list is organized.
> 
> Is this a list or a spreadsheet?
> 
> In your example, 500 is referred as what? Element 1 of a list of 9 that includes (500,1500,5000 … and 3 “undefined”) ?
> 
> The problem is not how to do thing, the problem is determining how things are saved now, THAT decides how to go about processing it.
> 
> So what do you have? What am I looking at? A bunch of 36 separate entities? 4 lists (column) of 9 elements each? One list of 4 lists of 9 elements?  
> Are you expecting to leave those #7, #8 place holders there, or would an empty field be left blank?  
> What about the 4th column?

Column 1 and 2 are text\_imput because we need put the numbers… column 3 and 4 are labels because this columns just return us the results…

Are you expecting to leave those #7, #8 place holders there, or would an empty field be left blank?  
What about the 4th column?"

Its impossible to know, because you just will know in the moment are using the app… So if have 3 people, will use only 3… if have 9, will use 9…

Its better use list? please give me ideas to do this…  
So dont remember, column 1 and 2 we need put the numbers and columns 3 and 4 no… 😉

Thanks.

---

<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 19, 2019, 12:09am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/7 "2019-06-19T00:09:00Z")

</div>

Well then, they are not arranged in a list, so cannot be indexed.  
I am afraid you will have to get a long equation that calls each text\_input by name, the system does not have any way knowing you want to add those.

In classic, you could have made a list that refers to each of those text\_input, and you could then use the content of each of those components in a loop that would access them each in sequence, but that is one of the feature they apparently have not yet deployed in X. Classic also has those text entry event that could behave like a button click, so could push the data into a list using an index specific to each text field.

If your values were in a list, that would have meant that the individual text\_entry were already explicitly associated to a specific element of the list somewhere else in your code.

There isn’t much you can do with the current components that would not imply quite a bit of code.  
One approach would be to _replace_ all your text entry with a button that is showing on TOP (or in the same place) as the text entry. When you click in a button to enter data in it, the logic takes a note of which button is currently having the focus, cause the button to become invisible while makes the text entre become visible. When the entry is done, then someone evidently has to click somewhere else, so the logic would know to take the text entry value, push that in a list at the index location, use that value again as a caption to the button (so the value is visible). You still have an issue when the very last entry is in since there is no other button left to click, unless you make one to call for getting the total.

As I said, not matter how you look at it, it is not straightforward with the current version of X…

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 1:09am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/8 "2019-06-19T01:09:07Z")

</div>

No problem create a buttom “calculate” to give the results…

So, i need change the 9 text imput from column 1 and 2 to list? 🤔

Its better classic thunkable? because not are a problem to change…

---

<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 19, 2019, 1:33am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/9 "2019-06-19T01:33:55Z")

</div>

Yes, it would be a lot simpler in classic.  
The down side is that classic does not support iOS; only Android.

But you cannot really display the data from a list, you still need a displayable component that is associated with the list element. That is where the problem is: you would need a list for easy data processing AND a unique component for each display. In classic thunkable, the association between those is much simplified thanks to the “any component” feature.

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 5:18am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/10 "2019-06-19T05:18:20Z")

</div>

i can imagine… but i need support iOS =(

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

hope one day i can do this =P

---

<div class="post-metadata">

### Author: ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)
#### Post date: [June 19, 2019, 12:35pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/11 "2019-06-19T12:35:10Z")

</div>

Hi there,

You can add three numbers together by nesting two + blocks, so that you have  
((number1 + number 2) + number 3)

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 3:32pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/12 "2019-06-19T15:32:31Z")

</div>

can you show me how?  
i will need add 9 numbers, its possible?

thanks

---

<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 19, 2019, 4:27pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/13 "2019-06-19T16:27:41Z")

</div>

Something like this:

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

where the respective 1, 2 3 and so on are replaced by whatever it is you need to add.  
_HOWEVER_ there is an important aspect in that whatever value you DO NOT HAVE need to be set to zero or be seen by the program as being zero.  
You probably will need to test it to ensure empty fields are indeed empty (as opposed to be populated by those #8 “hints” if they are more than just hints to the program)

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 5:02pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/14 "2019-06-19T17:02:26Z")

</div>

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

Yes my friend YES!

I change all hints #x for text = 0… so its fine now =D

Thanks!!!

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 5:50pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/15 "2019-06-19T17:50:14Z")

</div>

its possible have the #1 - #9 hints and the program see this is 0?

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 5:56pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/16 "2019-06-19T17:56:47Z")

</div>

When i put the numbers, i have the result in the column 3, but the numbers appers 113.63636363… Its possible show only 113.63 or 113.64? just 2 “houses” max?

---

<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 19, 2019, 6:57pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/17 "2019-06-19T18:57:10Z")

</div>

How do you end up with more decimals than you started with using only additions? You have a multiplication or division in there as well?

Anyway, this function will round any value to the number of decimals you want. If you put a negative value for places, like -1, it will round to the nearest 10. Putting places=2 will give you 2 decimals.

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

I invite you to read other people questions, since this exact function was provided 3 days ago for someone else. Reading would have saved you asking the exact same thing.

---

<div class="post-metadata">

### Author: ![db82203608aa4b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/db82203608aa4b/32/33512_2.png) [@db82203608aa4b](https://community.thunkable.com/u/db82203608aa4b)
#### Post date: [June 19, 2019, 8:32pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/18 "2019-06-19T20:32:05Z")

</div>

I try read forever before i create another topic, but sometimes i dont know the key words to search… =(  
Sorry CBVG, but thanks for help me =)

Yes, the column 3 use multiplication and divison to return the exact answer i need.  
See here…

---

<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 19, 2019, 9:03pm UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/19 "2019-06-19T21:03:55Z")

</div>

I try read forever before i create another topic, but sometimes i dont know the key words to search… =(  
Sorry CBVG, but thanks for help me =)

Yes, the column 3 use multiplication and divison to return the exact answer i need.  
See here…

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/9712f1942d21f00bbf8fc4c2146584c6eef4a924.png)

i cant acess this account (db8220…) so i will use this new…

---

<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:21am UTC](https://community.thunkable.com/t/how-to-sum-numers-from-a-list/111583/20 "2019-06-20T04:21:22Z")

</div>

Hi, @Yukold! 👋  
Try to use this block : (it only works with a list.)  
 ![very%20temp](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/4/e4fff196a9e969a8593b7166aac790b53eba4c45.png)

Thanks 😉

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