442
Views
4
Comments
Solved
How to convert number into xx.xx thousand/million/billion/trillion format
Question

I have a long amount values and I need to convert those in short format.
IF 15000, Then 15 Thousand.

IF 1450000, Then 1.45 million.

and so on...


Kindly let me know the simple ways to achieve this.


2024-12-04 07-24-25
Amol
Solution

Thanks Eduardo,

I did the same, But looking for any other better option if available.

Or please correct/modify If you found anything wrong in below code:


If(Value > 1000000000000, Round( (Value/1000000000000), 2 ) + " Trillion",
    If(Value > 1000000000, Round( (Value/1000000000),2 ) + " Billion", 
        If(Value > 1000000, Round( (Value/1000000),2 ) + " Million", 
            If(Value > 1000, Round( (Value/1000),2 ) + " Thousand",
                Value
            )
        )
    )
)
2020-02-28 09-46-54
Eduardo Jauch

The simplest way is to write a function that receives the value and returns the correct text formatted, based on a switch or series of IFs where you compare the size of number starting from the biggest size. 

Cheers

2024-12-04 07-24-25
Amol
Solution

Thanks Eduardo,

I did the same, But looking for any other better option if available.

Or please correct/modify If you found anything wrong in below code:


If(Value > 1000000000000, Round( (Value/1000000000000), 2 ) + " Trillion",
    If(Value > 1000000000, Round( (Value/1000000000),2 ) + " Billion", 
        If(Value > 1000000, Round( (Value/1000000),2 ) + " Million", 
            If(Value > 1000, Round( (Value/1000),2 ) + " Thousand",
                Value
            )
        )
    )
)
2020-02-28 09-46-54
Eduardo Jauch

Don't think there are any other way... 

And your code seems corrrect. 

Cheera

2017-12-13 08-27-28
Joey Moree
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.