How do you add number abbreviations

basically, I’m working on an app and I want to be able to have it so that instead of numbers being like 10000 it becomes 10k.

so if a value was 13,382 it would turn into 13.38k
or if it was 372,281 it would turn into 372.28k
or if it was 1,291,291 it would turn into 1.29m

You’re going to need some IF blocks. If num < 1000 then display num, else if num < 1000000 then display join round(num/1000) & “k”, else display join round (num/1000000) & “m”

Thank you. But is there any way to make it more exact? Like 5.2k or something?

Sure! You can use any divisor you want. So if the number is in the thousands, divide by 1000 and round to one decimal place using this block:

image

If you need more help, post a screenshot of the blocks you’ve tried and explain the result and I can help you further.

sorry, i couldn’t resist the challenge!
here’s a demo to call a standard routine for abbreviating a number all the way to the billions with 2 decimal places for the abbreviation estimates:
image

here’s the code:

and here’s the project link
https://x.thunkable.com/projects/633341745316150557381fa3/4c6410d9-af01-43ff-ae29-7eed4bf7c004/blocks

3 Likes