# How to sum numbers from list

Dear Thunkers,

I’m building an app to convert text to number and after that this app will sum all numbers. For example: when users type to textbox: TEDDY, app will convert to 75443 and after that it will take a sum of 7+5+4+4+3 = 23. And display 23 in label.

Can you help me

There’s a “sum of list” block. Once you split your word up and translate your letters to numbers, it’ll do the rest.

1 Like

If you dont mind, please help send me the block. I have tried to use sum of list block but it doesn’t work

Can you post a screenshot of the blocks you’ve tried? That way we can help you fix the problem.

3 Likes

Dear,

This is my main screen

When user typing the name in textbox (UPCASE)
and tab translate button, it will convert the result to label.

This is Local Database to convert

And this is block

When I type TEDDY to textbox, it will convert to 25447. But I don’t know how to take a sum 2+5+4+4+7 = 22.

If I understand correctly, Label1’s Text value will be “25447” and you want to sum the digits to return 22.

These blocks will do that:

My dear,

Thanks for your support. I have build the blocks like that and show the return to label5’s text. But it not work.

This is block

And this is result. Label5 still is 0

you miscopied tatiang’s block.

change the block (see arrow) with <Label1’s text> . copy it from the statement before.

Right. The algorithm is:

``````Set the sum to zero
Loop through each digit of Label1's Text:
In Label1's Text (this is what you're missing), get the character at position i
Convert the character to a number
Add the number to the sum
``````

My Dear,

Thank you so much! I have added label1’s text to “abc” but it still doesn’t work

in this block segment, refer to the block marked (X)

use this block:

1 Like

Dear @tatiang and @manyone,

Big thanks to both of you. It’s working!