Colors in an IF function w/ conditional formatting

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
I have multiple conditional formats and I want the cell to automatically change the text to 'High'/'Medium'/'Low' depending on the color generated by the formatting but can't seem to figure out how do it.

My conditional formatting is:
=AND($J17=5, $K17=5)
The formatting will change this cell to the color red or color index 3

This is currently what I have as the If function:

Function GetfillColor(Rng As range) As Long
GetfillColor = Rng.Interior.ColorIndex
End Function


Function CheckColor2(range)
If range.Interior.ColorIndex = 3 Then
CheckColor2 = "High"
ElseIf range.Interior.ColorIndex = 44 Then
CheckColor2 = "Medium"
ElseIf range.Interior.ColorIndex = 43 Then
CheckColor2 = "Low"
End If
End Function

I have multiple conditional formats and I want the cell to automatically change the text to 'High'/'Medium'/'Low' depending on the color generated by the formating but can't seem to figure out how do it.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
How do you get the other two colors, 44 and 43?

Instead of getting the color index, maybe you can use the rules that generate different colors in the IF formula, something like =IF(AND($J17=5, $K17=5), "HIGH", IF(....,...,)). If you want a VBA approach, then use "IF AND($J17=5, $K17=5) THEN ....".
 
Upvote 0
How do you get the other two colors, 44 and 43?

Instead of getting the color index, maybe you can use the rules that generate different colors in the IF formula, something like =IF(AND($J17=5, $K17=5), "HIGH", IF(....,...,)). If you want a VBA approach, then use "IF AND($J17=5, $K17=5) THEN ....".

I get the other two colors by using the same functino 'Function GetfillColor(Rng As range) As Long' and apply it to 2 other cells with different colors in them.

I tried using the =IF(AND in the conditional formatting formula but it will not apply properly. =IF, =AND both work indignantly though which is odd. Is there something in my workbook or settings that would limit the types of formula you can use in 'Conditional Formatting'?
 
Upvote 0
I don't know any settings that would do that.

What odd results did you get?
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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