Conditional format if value within a % of another cell value

nparsons75

Well-known Member
Joined
Sep 23, 2013
Messages
1,256
Office Version
  1. 2016
I have a table as below. I need the cell AVG ALL to be conditionally formatted to show the following...

If AVG ALL is less than TARGET by no more than 5% then fill colour AMBER.
If AVG ALL is less than TARGET by more than 5% then fill colour RED.
If AVG ALL is equal to or more than TARGET then fill colour GREEN.

The current result for AVG ALL would be RED. If the value was 86% for example, the colour would be AMBER.

Appreciate any help. Thanks in advance...


TARGETAVG 20AVG 21AVG ALL
88%79%75%79%
 
i didnt notice the CELL values changed

Lets try again

you may want to change where the equal lies, I have used =5% for amber AND for 0% = Green - easy to change as needed

OEE Data.xlsx
ZAAABACADAEAFAGAHAIAJAKAL
3TARGETAVG 20AVG 21AVG ALLKPI
489%79%75%79%Performance-10%If AVG ALL is less than TARGET by no more than 5% then fill colour AMBER. If AVG ALL is less than TARGET by more than 5% then fill colour RED. If AVG ALL is equal to or more than TARGET then fill colour GREEN.
599.5%99.4%99.4%99.4%Quality0%
685%79%69%78%Availability-7%
775%62%51%61%OEE-15%
889%74%67%74%Performance-15%
999.5%99.5%100.0%100%Quality0%
1085%78%76%78%Availability-7%
1175%58%51%57%OEE-18%
1289%71%70%71%Performance-18%
1399.5%99.5%99.5%100%Quality0%
1485%82%72%81%Availability-4%
1575%58%50%57%OEE-18%
1689%85%78%84%Performance-5%
1799.5%100.0%100.0%100%Quality1%
1885%85%86%85%Availability0%
1975%73%67%72%OEE-3%
2089%84% 84%Performance-5%
2199.5%99.8% 100%Quality0%
2285%81% 81%Availability-4%
2375%68% 68%OEE-7%
2489%94%97%94%Performance5%
2599.5%99.5%99.6%99%Quality0%
2685%78%79%78%Availability-7%
2775%73%76%73%OEE-2%
2889%95%97%95%Performance6%
2999.5%99.2%100.0%99%Quality0%
3085%83%83%83%Availability-2%
3175%78%80%78%OEE3%
Sheet1
Cell Formulas
RangeFormula
AA4:AA31AA4=AVERAGEIF(B4:M4,"<>0")
AB4:AB31AB4=IFERROR(AVERAGEIF(N4:Y4,"<>0"),"")
AC4:AC31AC4=AVERAGEIF(B4:Y4,"<>0")
Z7,Z31,Z27,Z23,Z19,Z15,Z11Z7=Z4*Z5*Z6
AE4:AE31AE4=AC4-Z4
Cells with Conditional Formatting
CellConditionCell FormatStop If True
AC4:AC31Expression=AND((AC4-Z4)>=-0.05,(AC4-Z4)<0)textYES
AC4:AC31Expression=(AC4-Z4)<-0.05textYES
AC4:AC31Expression=(AC4-Z4)>=0textYES
AD28:AD30Cell Value=0textNO
AD31Cell Value=0textNO
AD24:AD26Cell Value=0textNO
AD27Cell Value=0textNO
AD20:AD22Cell Value=0textNO
AD23Cell Value=0textNO
AD16:AD18Cell Value=0textNO
AD19Cell Value=0textNO
AD12:AD14Cell Value=0textNO
AD15Cell Value=0textNO
AD8:AD10Cell Value=0textNO
AD11Cell Value=0textNO
AD3Cell Value=0textNO
AD4:AD6Cell Value=0textNO
AD7Cell Value=0textNO
AC3Cell Value=0textNO
AC3Cell Value=0textNO
AB3Cell Value=0textNO
AB3Cell Value=0textNO
N3:AA3Cell Value=0textNO
Z3:AA3Cell Value=0textNO
 
Upvote 0
Solution

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi, I do not know what im doing wrong but must be something...

Amber now doesn't show and gives a white cell. I have tried set the format of the cell to text also but that just gives a lot of decimal places and no change to the colour?

1613757494497.png
 
Upvote 0
Thats what I had
what are the 3 formulas
 
Upvote 0
in the conditional formatting rules
like mine
BUT with your Actual cells

=AND((AC4-Z4)>=-0.05,(AC4-Z4)<0) = AMBER
=(AC4-Z4)<-0.05 = RED
=(AC4-Z4)>=0 +GREEN
 
Upvote 0
=AND((AE284-AB28)>=-0.05,(AE284-AB28)<0) = AMBER
=(AE28-AB28)<-0.05 = RED
=(AE28-AB28)>=0 = GREEN


1613758759755.png
 
Upvote 0
Different cells
=AND((AE284-AB28)>=-0.05,(AE284-AB28)<0) = AMBER
=(AE28-AB28)<-0.05 = RED
=(AE28-AB28)>=0 = GREEN

should they all be AE28 & AB28
NOT AE284 ?

so

=AND((AE28-AB28)>=-0.05,(AE28-AB28)<0) = AMBER
=(AE28-AB28)<-0.05 = RED
=(AE28-AB28)>=0 = GREEN
 
Upvote 0
UNBELIEVABLE......

=AND((AE284-AB28)>=-0.05,(AE284-AB28)<0) = AMBER

When altering the cell values, I hadn't deleted the 4...... Great spot, around 3 hours trying to get to the bottom of that!! :oops:
 
Upvote 0
no problem
happened to me too - different Column in the AMBER
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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