Custom number formats (Excel 2000)

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15633
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Custom number formats (Excel 2000)

Post by ChrisGreaves »

I had occasion to delve into this and thought to share what I learned.
A worksheet has results in Kilowatt-Hours and in Horsepower.
I created two styles:

Code: Select all

KWhr2
#,##0.00 "KWhr"
and

Code: Select all

HP2
#,##0.00 "HP"
Both styles display two decimal digits (hence the suffix in their names).
It took me a minute or two to figure out that the strings had to be enclosed in double-quotes.
There's nothing heavier than an empty water bottle

User avatar
HansV
Administrator
Posts: 78516
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Custom number formats (Excel 2000)

Post by HansV »

You can also prefix a character with a backslash to tell Excel to take it literally instead of as a formatting code. This is especially useful if you want to add just a single character:

Metres

#,##0.00 \m

is equivalent to

#,##0.00 "m"
Best wishes,
Hans