Conditional Formatting Based on XLOOKUP value

psycoperl

Active Member
Joined
Oct 23, 2007
Messages
339
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
  3. Web
Good Day - I am working on a task where I have a table and I want to highlight via conditional formatting certain cells if a criteria is met. I have a XLookup in Column L that will return either a 0, 1, 2, 3, 4, 5. Based on that value determines which formatting I want to have applied to Columns J and K. However, I am not able to get that formatting working.
I have gotten the formatting for when column G is changed to a value working and for when there are duplicate values in column B. Can you please provide some guidance?

Test.xlsx
IJKL
1Automatic Direct Placement?Auto Direct Placement DescrAutomatics Direct Placement Special CriteriaColumn2
2M205MTH 2205 Placement1
3NTMTMTH Placement TBD / (Old MTH 7000)3
4NTMTMTH Placement TBD / (Old MTH 7000)3
5-NO-NO AUTO PLCMNT0
6-NO-NO AUTO PLCMNT0
7-NO-NO AUTO PLCMNT0
sheet1
Cell Formulas
RangeFormula
J2:J7J2=IF(NOT(ISBLANK(sheet1!$I2)),XLOOKUP(sheet1!$I2,Sheet3!A$1:A$18,Sheet3!C$1:C$18,"",0,1),"")
L2:L7L2=XLOOKUP($I2,Sheet3!A$1:A$18,Sheet3!D$1:D$18,"",0,1)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:K2152Expression=ISNUMBER(MATCH($I2,Sheet3!$B$3:$B$16,0))textNO
A2:K2152Expression=$G2=Sheet2!$A$3textNO
A2:K2152Expression=$G2=Sheet2!$A$1textNO
A2:K2152Expression=$G2=Sheet2!$A$2textNO
J2:K2152Expression=$L2=0textYES
J2:K2152Expression=$L2=1textYES
J2:K2152Expression=$L2=2textYES
J2:K2152Expression=$L2=3textYES
J2:K2152Expression=$L2=4textYES
J2:K2152Expression=$L2=5textYES
G228:H447,A2:K294,A449:K2152Expression=AND(LEN($B2)>0,AND($B2=$B1,$B2=$B3))textYES
G228:H447,A2:K294,A449:K2152Expression=AND(LEN($B2)>0,$B2=$B3)textNO
G228:H447,A2:K294,A449:K2152Expression=AND(LEN($B2)>0,$B2=$B1)textNO
Cells with Data Validation
CellAllowCriteria
I1:I7List=Sheet3!$A$1:$A$18


Test.xlsx
ABCD
1COLOR TABLE
2-NO---- NO AUTO PLCMNT ---NO AUTO PLCMNT0
3M100M100 - IBSIP 0100 Math PlacementIBSIP 0100 Math Placement5
4M103M103 - MTH 1030 PlacementMTH 1030 Placement1
5M120M120 - CSTM 0120 PlacementCSTM 0120 Placement5
6M123M123 - MTH 1023 PlacementMTH 1023 Placement1
7M203M203 - MTH 2003 PlacementMTH 2003 Placement1
Sheet3
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If you want the values in col L to overrule the other formats, then you will need to move them to the top of the list.
 
Upvote 0
Duh! Ok. I think I need a vacation. Works fine now.:geek:

Now that I have the color scheme working - I want to simplify and not have to use the column L to determine the color and have the XLookup in Conditional Formatting. Reducing the chance of someone deleting the column or changing the formula accidentally.

When I change the Condition =$L2=1 to =XLOOKUP($I2,Sheet3!A$1:A$18,Sheet3!D$1:D$18,"",0,1)=1 only column J gets formatted, column K does not.
 
Upvote 0
It would need to be
Excel Formula:
=XLOOKUP($I2,Sheet3!$A$1:$A$18,Sheet3!$D$1:$D$18,"",0,1)=1
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Similar threads

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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