Data validation formula to change cell colour based on percentage of value in the above cell

xpat

New Member
Joined
Jun 10, 2024
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
I'm trying to create data validation rule that will change cell color depenidng on percentage of the value from the cell above e.g. G7/G6>0.8 change cell color to green, G7/G6>0.5 red etc.

How do I create a formule in data validation that will apply this rule to all selected cells without referencing a specific cells for this calculation?

The formula works if I used a specific cell references but I need something more flexible that will apply the rule across all calls in the same row but consecutive column.

Thank you in advance for the support.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Conditional formatting formulas work in the same way that formulas do, in that as they move from cell to cell the references to columns and rows update accordingly, unless preceded by a $ symbol.
The key is to highlight the entire range you want formatted but write the formula as it applies to the first cell/range/row/column you want formatted.
So in your case (see example below) and assuming your data of interest begin in row 3:
  • Select rows 3 to the bottom row
  • Conditional formatting->New rule->Use a formula...
  • Write the formula(s) as it applies to the first row.
  • Repeat for each condition.
Book1
ABCDEFGHIJ
1ValueRatio for example
28
3101.3
430.3
562.0
640.7
751.3
881.6
920.3
10
Sheet1
Cell Formulas
RangeFormula
H3:H9H3=G3/G2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
3:9Expression=$G3/$G2>0.8textNO
3:9Expression=AND($G3/$G2>0.5,$G3/$G2<=0.8)textNO
3:9Expression=$G3/$G2<=0.5textNO
 
Upvote 0

Forum statistics

Threads
1,224,812
Messages
6,181,091
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