Conditional formatting: Data bar, no negative, max 100%

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,922
Office Version
  1. 365
Platform
  1. Windows
Hi,

In B4, I have formula =B6-SUM(B7:B8)
In C4 I have formula = (B6-SUM(B7:B8))/B6 (formatted %)

Where B6 = 1,000,000, B7 = 200,000, B8 = 400,000

I wish to achieve the following:

When C4 is 0%-100% a data bar in B4 for an equivalent % fill

When B4 is negative to show 100% fill

I can't figure out how to conditional format this, can anyone help please?

TIA,
Jack
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Maybe only with VBA.

Why not format negative numbers with no fill ? - then can do without VBA.
 
Upvote 0
Thanks for replying @footoo - unfortunately I couldn't figure out how to force conditional formatting setup to exclude negative numbers.

Ended up with a work around that kinda does what I needed but not quite as the initial post asked.

Basically the formula is for a team to monitor if they hit or exceed their target.

However, when they exceed it, the numerator becomes negative so the final value is negative which causes this issue.

Tried using MAX, MIN to put a cap on the value but couldn't get to work, whether in cell formula or in the CF formula or even cell formatting, to prevent the negative, but keep the formula "working" when target was < 100% reached.
 
Upvote 0
That's quite a bit different from your original post.

However, if you just want to show a DataBar for positive values and nothing (or a different color) for negative values :
- Set the DataBar required then click on "NegativeValue and Axis..." in the edit rule dialog box
- Set the Fill Color and the Border Color to white (or some other color)

Tried using MAX, MIN to put a cap on the value but couldn't get to work, whether in cell formula or in the CF formula or even cell formatting, to prevent the negative, but keep the formula "working" when target was < 100% reached.
• To prevent negatives and return 0 instead :
C4=IF(B4<0,0,B4/B6)
• To keep negative values but display 0 :
Cell format : 0%;0\%;
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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