Custom Formatting

ypurcaro

New Member
Joined
Mar 7, 2013
Messages
29
Hello All,

I have a custom format for the number as below
100 - 0.1K
1000 - 1.0K
10000 - 10.0K
200000 - 200.0K
4000000 - 4Mil

Here is what I entered to the custom format:
[>=1000000]#,##0,,"Mil";[<1000000]#,##0.0,"K";General

Now, for the 100, I don't want it to read "0.1K", how should I fix that?

Thank you!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Try this way instead,

[>=1000000]#,##0,,"Mil";[<1000]General;#,##0.0,"K";@

With custom parameters the first format is for values greater than specified, the second is for values less then specified and the third is for anything between the two specified values.
The final @ is for anything that is not numeric.
 
Upvote 0
Solution
Try this way instead,

[>=1000000]#,##0,,"Mil";[<1000]General;#,##0.0,"K";@

With custom parameters the first format is for values greater than specified, the second is for values less then specified and the third is for anything between the two specified values.
The final @ is for anything that is not numeric.
Hi jasonb75,

Thank you for your response. The code works fine if the numbers are positive; however, when the numbers are negative, it didn't work. I had a negative number like this (8,426,009). After I applied the custom format, it became -8426008.99 It seems like it's totally off.

Thanks again!
 
Upvote 0
That might need a bit of creativity with conditional formatting.

Should negatives have the same format as positives, e.g. something like (8.4m)
 
Upvote 0
Try with the cell format from my earlier post and this one applied by conditional formatting to cells with a value <0

[Red][<=-1000000](#,##0,,"Mil");[Red][>-1000](#0);[Red](#,##0.0,"K");@

Not sure why some have the leading - sign and others don't, I'll look into that in more detail later if necessary.
Book1 (version 1).xlsb
AB
1100-(100)
21.0K-(1.0K)
310.0K-(10.0K)
4100.0K-(100.0K)
51Mil(1Mil)
Sheet7
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:B5Cell Value<0textNO
 
Upvote 0
Try with the cell format from my earlier post and this one applied by conditional formatting to cells with a value <0

[Red][<=-1000000](#,##0,,"Mil");[Red][>-1000](#0);[Red](#,##0.0,"K");@

Not sure why some have the leading - sign and others don't, I'll look into that in more detail later if necessary.
Book1 (version 1).xlsb
AB
1100-(100)
21.0K-(1.0K)
310.0K-(10.0K)
4100.0K-(100.0K)
51Mil(1Mil)
Sheet7
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:B5Cell Value<0textNO
Hello there,

I tried to play around the formula but have no luck with it. Anyway, thank you for helping me.
 
Upvote 0

Forum statistics

Threads
1,215,759
Messages
6,126,720
Members
449,332
Latest member
nokoloina

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