Home » excel » function – Number Formatting in Excel

function – Number Formatting in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

The Bloomberg Terminal has an interesting way of formatting numbers. I want to imitate this format in Excel, but have been struggling to get it to make it work.

Examples of the formatting I want is:

  • 1,000,000 = 1MM
  • 1,400,000 = 1400M
  • 100,000 = 100M
  • 75,000 = 75M
  • 10,000,000 = 10MM
  • 25,300,000 = 25,300MM

Any help would be greatly appreciated!

How to&Answers:

Interesting question. Here’s one more solution that you can use (independent of the number of zeros):

=TEXT(LEFT(A1,LEN(A1)-((LEN(A1)-LEN(SUBSTITUTE(A1,0,"")))-MOD((LEN(A1)-LEN(SUBSTITUTE(A1,0,""))),3))),"#,##")&REPT("M",(LEN(A1)-LEN(SUBSTITUTE(A1,0,"")))/3)

LEN(A1)-LEN(SUBSTITUTE(A1,0,"")) part is counting how many times “0” is occurring in a given string.

The result looks like that:

enter image description here

Answer:

Here’s a formula that would handle up to 6 zeros. You could easily add a condition for more zeros at the beginning:

=IFS(RIGHT(A1,6)="000000",LEFT(A1,LEN(A1)-6)&"MM",RIGHT(A1,3)="000",LEFT(A1,LEN(A1)-3)&"M",TRUE,A1)

Results:
Results in spreadsheet