Convert number to k and m

hello can someone help me with this formula i want to show the numbers with K and M
1500000 = 1.5M
1000000 = 1M
1000 = 1k

i found this
formula number 1

i dont know were to find toFixed(1) in formula fonctions

Why not do a formula like this for millions (sample number =1576320):


Can do something more clever if you want a Javascript flow function, where you can instead specify the number of places, which is simpler since you don’t have to manual specify 100000 and 10.

1 Like

I now know that you can simply divide the number and use the ROUND function with precision parameter.

1 Like

It would be something like this with the above-mentioned suggestions:

IF(NUMBER(pageVars.yourNumber)/1000000>1, ROUND(pageVars.yourNumber/1000000, 2)+" M", IF(NUMBER(pageVars.yourNumber)/1000>1, ROUND(pageVars.yourNumber/1000, 2)+" k", pageVars.yourNumber))

But of course, it is just an example formula. This would vary on your own use case.

1 Like