Converting Numbers(Currency) into Million/Billion/Trillion

Hello,

I have a currency field in a Datatable which prints the number it has in the mail body. I need to convert that whatever number into more convenient way of reading as Million/Billion/Trillion. Do we have an option of doing that? Kindly post your valuable comments :slight_smile:

Eg: 2724577.2 USD needs to be printed as 2.72M USD (M = Million)

Thank you.

Hello! The first thing that comes to my mind is that you can easily tweak the components existing on Go! for converting numbers to words and obtain the result you need:




3 Likes

Hi @q-z;

Thanks for your valuable inputs. I will work on your suggestions and get back to you :slight_smile:

Hi @q-z,

I checked all those 4 custom activities you mentioned. They are merely converting whatever numbers we provide into words. But I need even more specific to mention in terms of millions like 2.7M, 0.6M… Can we do this in .net?

@PAVITHRAN,

You can do that as the following format, here my inputNumber is double datatype and I have imported System.Globalization in order to use Cultureinfo.

numbers

2 Likes

Hi @sarathi125,

Thanks for your help on this. It is printing values in Millions as expected… I need even more specific like if it 24,00,000 it should print 2.4M, but I am getting only 2M. Also, it’s not converting for values less than 10 lakhs. I tried alternating the values in the bold area (num.ToString("#,##0…M",CultureInfo.InvariantCulture)) but I am getting wrong output. Kindly help me on this and I will also keep exploring on this :slight_smile:

image

image

@PAVITHRAN,

Try with this one,

(2425000 / 1000000R).ToString("0.##") & "M"
2 Likes

Hi @sarathi125,

That’s amazing. It worked for me as expected :star_struck:. Thanks a lot :blush:

1 Like

Cheers @PAVITHRAN,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.