Custom Number format...

hbwhitehead

New Member
Joined
Feb 7, 2011
Messages
29
Would someone please advise me on a simple task?

If we have a list of numbers as such:
1.50
1.25
1.00

What is the format I can use to illustrate that following...
a) If there is .00 after then don't show the decimal or the zeros.
b) if there is .50 after then don't show the zero
c) if there is .25 after then show both numbers.

Thanks for your input.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
The General Format will do that.
The General Format drops all trailing zeroes from decimals, by default.
 
Upvote 0
ow do you make sure the formatting of has a "," for the 4 digit numbers[/COLOR]
Ah, a new wrinkle you didn't mention in your original question!

This is much trickier, as if you choose anything other than General, they want you to specify exactly how many decimals you want.
However, we can use Conditional Formatting to do this. We can set up three rules.
This example if for column A (so select column A and add the following Conditional Formatting conditions):

Rule 1, for no decimals
Conditional Formatting formula: =A1=ROUND(A1,0)
Format to choose: Number with comma and no decimals

Rule 2, for no decimals
Conditional Formatting formula: =A1=ROUND(A1,1)
Format to choose: Number with comma and one decimal

Rule 3, for no decimals
Conditional Formatting formula: =A1=ROUND(A1,2)
Format to choose: Number with comma and two decimals

Note that if you enter the conditions in this order, Excel will reverse them (it always put the last condition entered at the top).
So you will need to re-order them (by going to the "Manage Rules" option, and using the arrows to move them up and down).
You also want to check the "Stop If True" check box after each rule.
 
Last edited:
Upvote 0
If you only have two decimals to worry about, you can just use a format like
#,##0.##
but that will still give you the decimal point for integers, so you'd need a CF to apply for that situation.
 
Upvote 0
but that will still give you the decimal point for integers,
Yep, that is why I chose the method I did.
a) If there is .00 after then don't show the decimal or the zeros.
 
Upvote 0
I was really intending to point out that you only need one CF rule, not 3. ;)
 
Upvote 0
I was really intending to point out that you only need one CF rule, not 3.
Ah, gotcha. I see where you are going with that now.
Sorry, rough Monday morning. Still trying to get the caffeine IV drip working...
 
Upvote 0
I can relate - our coffee machine was out of order this morning!!
 
Upvote 0

Forum statistics

Threads
1,222,828
Messages
6,168,484
Members
452,193
Latest member
Arlochorim

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top