Format Cell

BigBeachBananas

Active Member
Joined
Jul 13, 2021
Messages
450
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi all,

I have the following issue with formatting numbers.

Sample positive numbers:
12.6357​
12635.7​
12,635,703.92​
12,635,703,916.48​

Current cell format: [>=1000000000]$#,##0.0,,,"B";[>=1000000]$#,##0.0,,"M";$#,##0.0,"K"
Sample positive output:

$0.0K$12.6K$12.6M$12.6B


My issue is with the negative values.

$0.0K-$12.6K-$12,635.7K-$12,635,703.9K

Notice the Millions and Billions are not rounded correctly as the positive version.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I'm not aware of any single Custom Format that will achieve your objective. There is a workaround however, using multiple custom formats couped with conditional formatting. Firstly, add the following 3 Custom Number Formats to your sheet:

$#0.0,"K";[Red]-$#0.0,"K";;@
$#0.0,,"M";[Red]-$#0.0,,"M";;@
$#0.0,,,"B";[Red]-$#0.0,,,"B";;@

Then apply Conditional Formatting selecting the appropriate number format as fits each condition:
formats.xlsx
ABCD
112.635712635.712,635,703.9212,635,703,916.48
2-12.6357-12635.7-12,635,703.92-12,635,703,916.48
3
4$0.0K$12.6K$12.6M$12.6B
5-$0.0K-$12.6K-$12.6M-$12.6B
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A4:D5Expression=AND(A4<0,A4>=-1000000)textYES
A4:D5Expression=AND(A4>=0,A4<=1000000)textYES
A4:D5Expression=AND(A4<-1000000,A4>-1000000000)textYES
A4:D5Expression=AND(A4>=1000000,A4<1000000000)textYES
A4:D5Expression=A4<-1000000textYES
A4:D5Expression=A4>1000000textYES
 
Upvote 0
Solution
I'm not aware of any single Custom Format that will achieve your objective. There is a workaround however, using multiple custom formats couped with conditional formatting. Firstly, add the following 3 Custom Number Formats to your sheet:

$#0.0,"K";[Red]-$#0.0,"K";;@
$#0.0,,"M";[Red]-$#0.0,,"M";;@
$#0.0,,,"B";[Red]-$#0.0,,,"B";;@

Then apply Conditional Formatting selecting the appropriate number format as fits each condition:
formats.xlsx
ABCD
112.635712635.712,635,703.9212,635,703,916.48
2-12.6357-12635.7-12,635,703.92-12,635,703,916.48
3
4$0.0K$12.6K$12.6M$12.6B
5-$0.0K-$12.6K-$12.6M-$12.6B
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A4:D5Expression=AND(A4<0,A4>=-1000000)textYES
A4:D5Expression=AND(A4>=0,A4<=1000000)textYES
A4:D5Expression=AND(A4<-1000000,A4>-1000000000)textYES
A4:D5Expression=AND(A4>=1000000,A4<1000000000)textYES
A4:D5Expression=A4<-1000000textYES
A4:D5Expression=A4>1000000textYES
This works. Appreciate the answer.
 
Upvote 0
This works for a table but doesnt seem to work for data labels when you create a chart from that table.
 
Upvote 0
This works for a table but doesnt seem to work for data labels when you create a chart from that table.
Which it was never meant to. If that is the issue you're facing, suggest you start a new thread.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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