Comments on: Custom Excel number format

Custom number formatting in Excel is a very powerful tool, and once you learn how to use it property, your options are almost unlimited. This tutorial explains the basics of the Excel number format and provides the detailed guidance to create custom formatting. Continue reading

Comments page 6. Total comments: 643

  1. Hello! Fantastic article, I have used it a lot in the past year!
    I have the following problem. I have a set of numbers in a column, some are integers, some are decimals. If I use something like #.##, then the integers appear with a dot at the end (ie. "42."), instead of just the number. Is there any way to make the decimal point conditional?
    (I am sorry if this has been asked already, I scrolled for a while but there are a lot of comments...)
    Thanks! Kalman

    1. Hello!
      Unfortunately, if you have selected a number format with a decimal separator, it will always be displayed.

    2. Ah never mind, I found the comment in the end where it is confirmed that it cannot be done :( It is weird though, one would expect to see whole numbers without a point in the end. I constantly need to explain this behavior to users which is annoying.

  2. In practical, I am using this method often (eg. #,##0,↑;[red]#,##0,↓;-). Unfortunately when ever I copy-paste into PowerPoint table, the Font Color format can't be copied into the PowerPoint.
    I checked using vba script of the cell target using script "rng.Font.ColorIndex" the result seems is not match with the shown font color that perform by Number Format.

    Is there any vba script to verify the color shown by Number Format?

    1. Hello Alexander,
      Thank's a lot for your fast response.

      I've been trial GetCellFontColor function to get the color code of a cell that use custome number format below,
      number format : #,##0,↑;[red]#,##0,↓;-
      trial number1 : 1000 (shown font color black). Validate using GetCellFontColor, Result = 0
      trial number2 : -1000 (shown font color red), Validate using GetCellFontColor, Result = 0 (instead 255 for red color).
      It seems the GetCellFontColor is using xlRange.Font.Color that work on cells, It can't detect the font color that produce by custome number format.

      Do you have any alternate function that can validate font color that produce by custome number format?

      I'll be greatfull for your advice.

  3. Ok firstly thankyou for this detailed article on custom number formating. I have struggling with it specially because i am from india and use indian number system which consists of lakhs/crore and not million billion. Was searching everywhere right from youtube but no success.. finally read this article and now i can show values in crores or in lakh.

  4. Great article - thanks. So much information here that you can't find elsewhere.
    I'm having trouble with a custom format. I'm trying to show a number in 4 digit format with a letter at the end. For example "50A" would show at "0050A", or "180C" would show as "0180C".

    Obviously if i remove the trailing letter from the cell i can get the 0000 custom type to work for the number alone, but when putting the trailing letter back in I don't know what to change my custom format too to also show the letter as well but also stay in the 4 digit format. Can you help?

    1. you can use custom format. just right click the cell and after your number format put "Aa".

      I.e. I wanted to calculate hours worked but I wanted "hrs" to show up after the numerical part of the result, so in custom I put: 00.00"hrs". If I wanted a space between the number and hrs I would just include a space between the last 0 and the quation mark like: 00.00 "hrs"

    2. Hello!
      Your data is text, not a number. Therefore, the 0000 custom format cannot work here. You can get the value you need in another cell using text functions.

  5. Thank You.

  6. Hi - Really informative article - appreciate all the details.

    I'm wondering if there is a way to hide blanks for currency, but have it apply to multiple currency types. My document displays either $ or € based on some other conditional formatting I've got built-in, but I can't seem to find a way to hide cells with a value of €0.00... it only seems to work for $0.00.

    Under cell formating, using custom formula, I'm using $#,##0.00;($#,##0.00); which I imagine only works for those cells with the $ currency type - is there a way to make this formula or something similar apply to both $ and €?

    Any help would be appreciated.

    1. Hello!
      €0.00 values will not be shown with this custom format:

      €#,##0.00;(€#,##0.00);

      Hope this is what you need.

      1. Hi - Thank you for the quick response!

        This seems to work only if the cell is in €. In this use case, the cell this formula is applied to varies between either $ or € depending on other conditional formatting variables. Is there a single formula/format that supports hiding multiple currencies or is that not possible?

        Thanks again.

  7. Hi! I have a series of fractions in 1 row that I would like Excel to convert to the percent format in the next row. How do I do this?
    Thanks!

  8. Hi,

    Looking for a custom number format that shows 450 as 0'5 and -450 as -0'5 (in red).

    0.0,;[Red]-0.0, shows 0.5 and -0.5, but need to show an apostrophe.

    Thanks,

    Simon

  9. i already made it as a conditional formatting for other non error cells and it keeps the data of the cell but it change it appearance to preview a "TEXT". however, i couldn't do the same to na() cells.

  10. Hello,

    I have an excel sheet that counts the number of data and reflects it on a pi-chart. however, i found it better to reflect zero cells as #N/A in order to not let it be visible in the chart until it gets a count.

    is there a way to format #N/A (basically error cells) as "TEXT" instead?

      1. As I am using the cell value in a pie chart I would like to exclude the zero values cells from being shown in the chart and found out the best way is to have the zero cells as #N/A. however, I would like to change the cell appearance to show "ZERO" instead of #N/A while keeping their values.
        I have tried using IFNA and ISNA functions in the Formatting and in the Conditional Formatting but it didn't work out for me, is there any other methods I can try to get this result?

          1. Actually what I am trying to do is to change only the appearance of the cell to show "ZERO" while maintaining the value of the cell as #N/A.

      2. is it possible to use these functions in the formatting? because i would like to keep the cell value as #N/A

  11. Hi,
    Thanks for the great page. Very through and structured.

    One query, though.
    Take the number 27618263177.12

    How can I custom format the cell so that it is shown as 2761.83. Basically, what I mean is I wish to use the Crores format.

    1. Hello!
      In custom Excel formats, you can show the number in thousands or millions. Unfortunately, your task does not match these possibilities. You can apply to round of numbers as described in this tutorial.

  12. Hi,
    Very good blog. Thank you.

    My problem is: I am dealing with a lab measurement. I need conditional decimal point length depending on another column. As follows

    if A1 = 0.001 C1 = 6.000
    A1= 0.1 C1= 6.0
    A1= 0.010 C1=6.000
    A1=0.02 C1=6.00

    Kindly Help me. Thank you

    1. Hello!
      Unfortunately, a custom format in Excel cannot use data from another cell. Your problem can be solved with a VBA macro.

  13. hey i want to get the number format where i can fix the number and change the values after decimal points .is this possible with custom format please reply me.for example i want to fix 12 then if i enter 75 then i want it as 12.75.

  14. Hi, How are You,
    I need to custom number format code in below format ( 12 Nuber )
    123456789025 Change of 1XXX XXXX 9025
    Pl. provide custom codeing
    thanks for help

  15. Hi Alex,
    I need assistance in excel format cells. I want to enter a number with 5 or 6 digits that will be in the following form
    9203 - 7 or 9203 - 77
    4 digits fixed dash 1 or 2 digits depending on whether the number is 5 or 6 digits

    When i enter number with 5 digits and it is formatted like this 0000 "-" 00 it is displayed as 0920 - 37 and should be 9203 - 7,
    and if I format it as 0000 "-" 0 then it is ok, but when I have a 6 digit number then with this format it shows me 92037 - 7.

  16. Thank you a lot, that was very helpful,

    tariq
    Saudi Arabia

  17. I deal with measurement units. Displaying the unit tells the reader what the number means. For instance, the format #,##0,, "MHz" will display the number 100000000 as 100 MHz. So I know the number means frequency. Similarly, I can use the format #,##0, "km" to display distances. I would like a way to display time so that the number 0.0015 is displayed as 1.5 msec or 1500 microsec. Is that possible?

  18. Thanks for your comprehensive article.

    Is there a way to extract a useful cell format from a referred to cell? If i do a =CELL("FORMAT",A1) and A1 is formatted Accounting with 2 decimal places, AKA (almost) #,##0.00 the value returned is ",2"

    ",2" is not useful in a =TEXT(A1,CELL("FORMAT",A1)) formula. I have to use a xref table to keep the formatting.

    So I want Excel to return #,##0.00 instead of ",2" so I can ditch the xref table...

    Thanks!

  19. Hi Alex,
    I need assistance in excel format. I have variance column which is column A minus column B. The result is rounded to zero decimal point using excel format.
    Now I dont want the variance to appear as Zero. If I have variance as 0.123 or 0.56 it should appear as dash (-) insted of Zero. Negative numbers should appear in red under bracket (15) or (-).
    Do we have any format option here.

    1. Hello!
      Custom Format indeed consists of 4 sections separated by a semicolon. Each section has its own assignment: 1 – format for positive numbers, 2 – format for negative numbers, 3 – format for zeros, 4 – format for text values. A user-defined number format can also contain up to two conditions which are entered in square brackets, e.g. [> 1] or [<= 1].
      When you use conditions in a user-defined number format, you redefine the first, second and third sections. For example, Custom Format for you -

      [>1] 0;[Red] -## ; "-"

      1. Hi Alex, thank you for the format. It works however i just want to understand what can be changed in above format so that if my number is -0.234, that also should appear as dash under bracket (-) insted of (0). The above format is working fine for positive & negative number and even if I have positive 0.234 its giving me dash insted of zero. But I need to keep an eye everytime when the output is in negative 0.234 so that it can be formatted as (-).

        1. Hi!
          Carefully read the article above and simply add brackets into a negative number format

          [>1] 0;[Red] (-##) ; "-"

          1. Hi Alex, Currently i am using below Combination of format which is giving me the result as
            [>0.5]$#,###0;[Red]$(#,###); "-"
            First portion of format
            1000.23= $1,000
            0.234= $- i dont want dollar
            0.534= $1
            Second portion of format
            -1000.23 = $(1,000)
            -0.523 =$(1)
            -0.234 =$(-) i dont want this, i need only dash here no dollar no bracket
            Third portion of format
            0= -

  20. I have an Excel column with over 70,000 entries in this format: 123456789A12345. All of them are nine numbers followed by a letter, followed by five more numbers.

    I'm trying to get it into the a format like this: 1-23-456-78-9A-12345. I have typed in a custom format of #-##-###-##-#-##### but it only works if there were no letters and every cell has the letter in the tenth position. Is there a symbol, like # that will allow the letter to be used in my custom format? Thanks.

    1. Hello!
      You cannot apply number format to text. Try this formula:

      =LEFT(A1,1)&"-"&MID(A1,2,2)&"-"&MID(A1,4,3)&"-"&MID(A1,7,2)&"-"&MID(A1,9,2)&"-"&MID(A1,11,5)

  21. HI Dear expert community,
    I'd like to get your advise, is it possible to add more that 1 conditional under Format Cell /Custom, I have this:
    [=1799.99]"Door";[=1200]"Box"

    but would like 2 add another to variables, I tried this, but didn´t work:

    [=1799.99]"Door";([=1200]"Box";([=1800]"Side";[=2400]"Top")
    [=1799.99]"Door";[=1200]"Box";[=1800]"Side";[=2400]"Top"

    Could anybody give a hint?
    I appreciate your kind support :D

  22. Very Detailed Article. No Words to appreciate....
    Very Helpful...

    Thanks for such a long article...

  23. Hi i am aware of the , and ,, rounding to thousands an millions in number formatting.

    However is there a way to round to the nearest tenth or hundreds in number formatting? I would like to preserve the original value in the cell (instead of round/up/down)

    e.g. value 2431 display as 2430 (to nearest 10)
    Display as 2400 ( to nearest 100)
    Thx.

      1. So which format code should I use to SHOW in tens?

  24. how can I split MP53HA2219 to MP 53 HA 2219 (needs to insert the space) {format will be same always}

  25. I solved the problem partially by holding the Alt key and entering 010, however, if I reduce the wide column, I have XXXXXXXXXXXXXXXX instead of the value...

  26. hello Alex

    I need to wrap the text in custom formatting as the column becomes too wide and spoils the excel sheet, is there a way to do that.

    this is what I have:
    "TOTAL PICK AISLE LOAD ("#,##0"kg/m2)"

    The column width is for the full text, I need to some how wrap it with in the custom formatting not from the tab as it does not work...

  27. Hi,
    I am using Excel with the region set to India. The numbers display as 1,00,000 by default. I want to change a few cells in this to display in the million 1,000,000 format.
    The default setting of #,##0 does not work and it displays as 1,00,000. Looks like putting in this format defaults to the default setting.
    Any suggestions? I do not want to change the region.
    Thanks.

  28. Thank you so mush for this complete and useful tutorial. What is the difference between #,##0 and #,# for thousand separator?

  29. Thanks, this info really helpful :)

  30. Hi, I'm trying to format my columns to where I type.25 and it turns to 0.25% but I keep getting 25.0% can anyone help please?

  31. Hi Alexander,

    I need to transfer this format 1.234-567.8 to a formula that I can use in Format cells Custom type. I then want to apply the custom formula to several cells with 8 digit numbers (e.g. 12345678) at once.

    Can you help me provide me with such a formula?

    / Robin

    1. Hi!
      Digit grouping symbol is set in Local Settings in the Control Panel. However, it is not possible to use several different separators. Also, it cannot be the same as the Decimal symbol. I'm really sorry, we cannot help you with this.

  32. Hello, great article. I want to have different currency formats, sometimes it needs to be comma for thousand separator and sometimes period, how do I do these number formats?
    Thanks!

    1. Hello!
      The thousands separator is set in the Windows Control Panel under Local Settings. There can only be one.

  33. how do we add colors with conditional formatting for more than 2 conditions. As i tried only 2 conditions are allowed in format axis eg.[Red][<=200]General;[Magenta][<500]General; how do we add more colors for different intervals?

  34. How do you convert custom format results to text? Can it be done in any simple way?

  35. Hi,

    Great tutorial.

    Is there a way to write a custom number format that removes decimal places while preserving the remaining syntax of a cell's accounting number format (including currency symbol and alignment, where the currency type is unknown?

    I am trying to create a conditional formatting formula that removes decimal places after a number exceeds a certain value, independent of whatever accounting currency style is in effect. I can't use VBA for this application.

    Thanks,
    Lloyd

    1. Hello!
      This format does not show the decimal part of the number if the number is> 99.

      [>99] $#,##0;$#,##0.00

      Pay attention to the following paragraph of the article above — Custom number formats based on conditions.
      I hope I answered your question.

      1. It looks like there is no way to re-format decimal place while preserving currency symbol without knowing the active currency symbol. I wish nested conditionals was allowed.

        I'll restrict to default currency symbol.

        Thanks for the help.

  36. Hi!
    I have a number consisting of nine to eleven digits, for example 12345678000.
    The first two digits have one “meaning”, digit number 3 and 4 have one "meaning" and digit number 5 to 8 have one "meaning". To improve the readability of the number I would like to group the numbers, with the groups separated by blanks/a space.
    I would like to show the number as follows: 12 34 5678 000
    I have tried number format ## ## #### ###, that works perfect as long as there are exactly three digits after digit number 8, for example 000 as above
    It there are two digits after the eights digit – the number is for example 1234567811 it is grouped like this: 1 234 567 811
    If there is one digit after the eights digit –the number is for example 123456781 it is grouped like this: 123 456 781
    What can I do in order for it to start counting the characters from the left and always grope the two first digits together, then the next two and then the next four, followed by the rest?

    1. Hello!
      You can apply this format if you convert a number to text:

      =LEFT(A1,2)&" "&MID(A1,3,2)&" "&MID(A1,5,4)&" "&MID(A1,9,20)

      I hope it’ll be helpful.

      1. Just wanted to let you know that while you haven't responded to my question (see above, March 9), this response to Anders provided a viable solution. So thank you!

        1. Hi,
          The thousands separator is set in the regional settings of Windows. But you cannot make the first separator "/" and the second " ". To do this, you need to convert your number to text and insert the necessary symbols into this text.

  37. Can a cell be referenced in custom formats? I want to combine the number in cell A4 with text when a date is entered in that cell.

      1. I didn't think so. Thank you!

  38. 45 x 48
    i want to do = 45 x 48 ft

  39. Is there a way to format using slashes and commas?
    Basically, I'm trying to format something with a 2 digit code, then a slash, then a 6 serial number separated by a comma.

    Here are some examples:
    16/123,456
    11/955,416
    22/546,000
    10/000,000

    I tried "00\/000,000" but that gave me a comma before the slash: "16,/123,456"

    Any thoughts?

    Thank you

  40. I need excel number format which shows fraction if there is any fraction value. If fraction value zero value should be appear without fraction.
    For eg: value is 25.50 it shows 25.50. if value 25.00 it shows 25

  41. Hi,
    Thank you for this. However I am stuck on something.

    I have numbers in the millions in a range of cells:
    Ex: 3,704,268.16 or -4,440,823.49

    I am using a format to round to the 000's

    #,###,; (#,###, )

    Which gives me a result of
    3,704 & (4,441)
    which is perfect

    but what's driving me crazy is when I have a formula within the cell and it nets a very low negative number I get this as an result: ( ).

    Is there any way of removing those brackets? when I run into a situation like that?

    Thank you in advance. I love the article its super useful!!!

  42. I want to write 22 and excel to show 0.22

  43. Thanks for sharing. This is super useful. Related to the "Indent" section, as it relates to text, this really isn't an "indent". At at least in doesn't behave (in 365/v16) the way manually adding indents does. It just adds space on the 1st line of wrapping text. Not to all lines.

  44. Hi
    I have a question about custom format cell , Which codes or characters in custom format cell should I use that when I copy a formula from another cell and past in formatted cell then the result of formatted cell (displayed number) does not change and main as before pasting?

    1. Hello!
      The information you provided is not enough to understand your case and give you any advice. Please describe your problem in more detail. Are you copying just a formula or an entire cell? To preserve the formatting, you need to use Paste Special - Formula or Value.

      1. hello, thanks for your help
        Suppose we have a table where the third column is the product of the first column multiplied by the second.
        a b a*b
        2 3 6
        6 3 18
        5 4 20
        3 5 15
        3 6 18
        2 7 14
        Then we change one of the cells of the third column using the custom format cell and the character “apple” as follows.
        a b a*b
        2 3 6
        6 3 18
        5 4 20
        3 5 apple
        3 6 18
        2 7 14
        Now if we copy the second row cell of the third column and paste it in the fifth row cell of the third column, the word apple changes to the number 15.
        My question is what character instead of “apple “ to use in the custom format cell that does not change the word apple after copying the second row of the third column and pasting in the fifth row of the third column?

        1. Hello!
          Your explanations are not very clear to me. But I can assume that you want to print the word before the number written in the cell.
          Use the format

          "apple " ##.##

          Pay attention to the following paragraph of the article above Add text to number formats
          Hope this is what you need.

          1. Thank you for your guidance.
            But that was not what I meant. In fact, I might ask the question, is it possible to define a format for a cell that contains a number that when we paste a formula into it , the number does not change in the cell ?

            1. Hi,
              A cell can contain either a formula or a number. The formula calculates the number to be displayed in the cell.

  45. Hi,

    In my country its not thousands(3 decimal places) , Mill (6 decimal places) and Bill(9 decimal places).
    Its thousands(3 decimal places), Lakhs (5 decimal places) and Crores (1 decimal places).

    So how to place the decimal place through custom formatting to convert it into Lakhs or Crores (Not at the same time obviously.

  46. I want to display like below

    10 to be displayed as 000000000000010
    -55 to be displayed as 000000000000-55
    12.22 to be displayed as 000000000012.22
    -23.33 to be displayed as 000000000-23.33

    1. Hello!
      You can use custom number format

      0000000000000##.##;0000000000000##.##

      Hope this is what you need.

  47. How do I display 4 left-most digits? I.e.
    123456789 should be displayed as 123400000
    0.123456789 should be displayed as 0.1234
    0.0001234567 should be displayed as 0.0001234

    Is this possible? Thanks.

    1. Hello!
      To extract the first 4 digits (other than 0) from a number, you can use the formula

      =LEFT(A1,MIN(IFERROR(FIND({1;2;3;4;5;6;7;8;9},A1,1),99999))+3)

      I hope my advice will help you solve your task.

  48. Good afternoon
    I have been studying custom number format but I would like to know what I am doing wrong in this exercise, please.
    A number greater than 1000, such as 52411, will be shown as $52 and a number less than 1000 will be shown as $0, also I need to have a custom format for negative numbers between parentheses.
    I tried to apply this format: [>=1000]$0, ;[<1000]$ "0" and it works for positive numbers, but when I try to format negative numbers Excels displays me an error message. What can I do to apply this format to negative numbers?
    Thanks

    1. Hello!
      To display numbers in thousands, use the custom format:

      [>=1000]$#,##0, ;[<1000]$"0"

      But in this formula, you cannot set a special format for negative numbers. Excel only allows one condition. You already have two.

      To show negative numbers in parentheses, you can apply the format

      #,##0;(#,##0;0

      I hope it’ll be helpful.

  49. I have whole numbers and some with a single decimal points. If I use say ##0.# if get "6." and "6.5", but would like "6" not "6." Is this possible to remove the "." with just formatting?

    1. Hello!
      If you want to show the fractional part of a number using formatting, then you need to use the Decimal point. Unfortunately, it will always be displayed.

  50. 00, what it's means?

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)