• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Custom number formatting - showing decimal point only when present

Hi,

In the attached file, in the yellow cells I am trying to apply custom number formatting. Here is what I am attempting to do.

1. If a whole number is entered, display it as is without a decimal point. For example, if 392 is entered, display 392 and not 392.00
2. If a decimal is entered, then display the decimal point and the digits to the right of the decimal. For example, if 7.5 is entered, display it as 7.5

Basically I'm trying to display the value as entered.

The problem I'm running into is being able to display a decimal point only when entered. Is this even possible?
 

Attachments

  • 0 DTE.xlsx
    10.6 KB · Views: 4
Custom format in this case will be hard if not impossible.
Conditional formatting might work based on this idea
If ( int ( cell ) = cell , text ( cell, " #.## 0") , text ( cell, "#.## 0,00" ) ).

You need to define in the rule only the true part. So the rule can be int ( cell ) = cell. And set format without decimals. This overrules your standard format with dzcimals.
I could not test since I do not have excel on my phone.
 
Back
Top