Conditional formatting color based on the result of a cell containing a formula

silver37

New Member
Joined
Jul 4, 2016
Messages
3
I need to conditionally format a cell based on the value of another cell which contains a formula.

I have columns headed as follows:

Goods Pack Size Shop 1 price/100g Shop 2 price/100g Shop 3 price/100g Cheapest price
apples 1kg 2.50 =2.5/10 4.20 =4.20/10 6.30 =6.30/10 MIN(D2,F2,H2)


Using conditional formatting, I want to be able to highlight the "Cheapest price" cell based on the cheapest price per 100g of the three shops:
Shop 1 = blue
Shop2 = green
Shop 3 = red

However, when I use the VALUE option (i.e. the value of the cheapest price column is equal to the value in Shop 1 price/100g) it doesn't fill the cell as the value of that cell is a formula not a number.

This is obviously a very simple version of a much larger sheet so I can't really add columns or paste values instead of formulas.

Any ideas?
 
I need to conditionally format a cell based on the value of another cell which contains a formula.

I have columns headed as follows:

Goods Pack Size Shop 1 price/100g Shop 2 price/100g Shop 3 price/100g Cheapest price
apples 1kg 2.50 =2.5/10 4.20 =4.20/10 6.30 =6.30/10 MIN(D2,F2,H2)


Using conditional formatting, I want to be able to highlight the "Cheapest price" cell based on the cheapest price per 100g of the three shops:
Shop 1 = blue
Shop2 = green
Shop 3 = red


However, when I use the VALUE option (i.e. the value of the cheapest price column is equal to the value in Shop 1 price/100g) it doesn't fill the cell as the value of that cell is a formula not a number.

This is obviously a very simple version of a much larger sheet so I can't really add columns or paste values instead of formulas.

Any ideas?

Hi,

I'm not understanding all your requirements, but for CF highlight the cell containing the cheapest price, select your D, F, H column data, CF using formula:

=D2=$I2


Excel 2010
ABCDEFGHI
1GoodsPack SizeShop 1price/100gShop 2price/100gShop 3price/100gCheapest price
2apples1kg2.50.254.20.426.30.630.25
Sheet1
Cell Formulas
RangeFormula
D2=C2/10
F2=E2/10
H2=G2/10
I2=MIN(D2,F2,H2)
 
Last edited:
Upvote 0
Hi,

I'm not understanding all your requirements, but for CF highlight the cell containing the cheapest price, select your D, F, H column data, CF using formula:

=D2=$I2

Excel 2010
ABCDEFGHI
GoodsPack SizeShop 1price/100gShop 2price/100gShop 3price/100gCheapest price
apples1kg

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]2.5[/TD]
[TD="bgcolor: #00B0F0, align: right"]0.25[/TD]
[TD="align: right"]4.2[/TD]
[TD="align: right"]0.42[/TD]
[TD="align: right"]6.3[/TD]
[TD="align: right"]0.63[/TD]
[TD="align: right"]0.25[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]D2[/TH]
[TD="align: left"]=C2/10[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]F2[/TH]
[TD="align: left"]=E2/10[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]H2[/TH]
[TD="align: left"]=G2/10[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]I2[/TH]
[TD="align: left"]=MIN(D2,F2,H2)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Hi there

Thank you for your reply.

It's the'Cheapest Price' column that I need to highlight based on the values returned in the three 'Price/100g' columns.

So, if the cheapest price/100g is
shop 1 - turn the 'Cheapest Price' cell blue
shop 2 - turn the 'Cheapest Price' cell green
shop 3 - turn the 'Cheapest Price' cell red

Hope that makes a better sense?

Thanks
Silver
 
Upvote 0
OK, I see:


Excel 2010
ABCDEFGHIJKL
1GoodsPack SizeShop 1price/100gShop 2price/100gShop 3price/100gCheapest priceCF Formulas for Column I
2apples1kg2.50.254.20.426.30.630.25BlueTRUE
3GreenFALSE
4RedFALSE
Sheet1
Cell Formulas
RangeFormula
L2=I2=D2
L3=I2=F2
L4=I2=H2


You need 3 separate CF rules for I2, so CF I2, using formula (as indicated above in L2, L3, L4), Format Fill as desired.
Then you copy the CF formatting down Column I with "Format Painter"
 
Last edited:
Upvote 0
OK, I see:

Excel 2010
ABCDEFGHIJKL
GoodsPack SizeShop 1price/100gShop 2price/100gShop 3price/100gCheapest priceCF Formulas for Column I
apples1kgBlue
Green
Red

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"]2.5[/TD]
[TD="align: right"]0.25[/TD]
[TD="align: right"]4.2[/TD]
[TD="align: right"]0.42[/TD]
[TD="align: right"]6.3[/TD]
[TD="align: right"]0.63[/TD]
[TD="bgcolor: #00B0F0, align: right"]0.25[/TD]
[TD="align: right"][/TD]

[TD="align: right"]TRUE[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]FALSE[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"]FALSE[/TD]

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: #DAE7F5"]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]L2[/TH]
[TD="align: left"]=I2=D2[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]L3[/TH]
[TD="align: left"]=I2=F2[/TD]
[/TR]
[TR]
[TH="width: 10px, bgcolor: #DAE7F5"]L4[/TH]
[TD="align: left"]=I2=H2[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]



You need 3 separate CF rules for I2, so CF I2, using formula (as indicated above in L2, L3, L4), Format Fill as desired.
Then you copy the CF formatting down Column I with "Format Painter"




Brilliant! Thank you jtakw :) Much appreciated!
 
Upvote 0

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