Search code examples
excelfunctionnumber-formatting

Number Formatting in Excel


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!


Solution

  • 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