Search code examples
excelcell-formatting

How to get an Excel cell format number without comma when it's an integer and with two digit after comma when it's a float?


I work with Excel and I try to find a good format for my cell. I work with numbers that can have more than 10 digit behind comma and with integer. I want a format that can display an integer when it's a integer(without any comma and digit behind it) and display a number with two digit behind comma when it's a number with comma.

I know that "General" format can show an integer as Integer and Number with comma as a number with comma, but this doesn't work because you can choose to get the only 2 first digit behind the comma in "General" format, you have to take all digit.

So here's my format for now General;General;"" I can try this too 0,00;-0,00;"" but this format ignore integer

PS: When I talk about number with comma I talking about float number not number that are separated with comma due to 1000.


Solution

  • There is no such format :-(

    As kind of a hack, you could apply a conditional formatting.

    As base numberformat use 0,00;-0,00;""

    Plus apply the following conditional formatting:

    • Formula: =A1=ROUNDDOWN(A1,0) i.e: = integer
    • Numberformat = 0;-0;""