tivo
tivo

Reputation: 146

Excel Custom Format: How to set a format that handles numbers with optional decimals

I'm having some trouble with Excel formats:

Example:

Value: 13
Expected result: 13 (not 13. )
Value: 13.5
Expected result: 13.5
Value: 13.1234
Expected result: 13.1234

Right now I'm using #.# format, but for the first value it always formats with the . character at the end. Any ideas?

Edit: We need to have this working for different number formats (%, $, etc). So we have the some additional examples:

Value: 13
Expected result: $13 (not $13. )
Value: $13.5
Expected result: $13.5
Value: $13.1234
Expected result: $13.1234

Upvotes: 0

Views: 772

Answers (2)

guitarthrower
guitarthrower

Reputation: 5834

The General format option does that already without any formulas needed.

Upvotes: 1

Mark Ransom
Mark Ransom

Reputation: 308121

Use conditional formatting. Use the formula =a1=round(a1,0) and set the formatting to 0.

Upvotes: 1

Related Questions