Conditional Formatting with OR condition

Tipsey

New Member
Joined
Oct 28, 2022
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Good evening,

I am applying a condtional formatting to a range based on an xlookup value and I was wondering if there was a more efficient way of performing this than using an or function.

ie. I would like to from something like:

=OR(XLOOKUP($DD1,$CG$6:$CG$205,$CE$6:$CE$205,"",0,1)=TIMEVALUE("5:15"),XLOOKUP($DD1,$CG$6:$CG$205,$CE$6:$CE$205,"",0,1)=TIMEVALUE("5:00"))

to

=XLOOKUP($DD1,$CG$6:$CG$205,$CE$6:$CE$205,"",0,1)=or(TIMEVALUE("5:15"),TIMEVALUE("5:00"))

I am currently, on looking for 2 values, but if there is more in the future, the more modular format of my target code would make it easier to adapt.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
You can do this:
Excel Formula:
=OR(TEXT(XLOOKUP($DD1,$CG$6:$CG$205,$CE$6:$CE$205,"",0,1),"h:mm")={"5:15","5:00"})

Obviously I can't test this without your data, but a simplified version worked for me.
 
Upvote 0
Thank you, I appreciate the response and would like to let you know that this achieved the desired result while testing the formula in a cell, but it gave an error putting it into the conditional formatting regarding the use of the array.
 
Upvote 0
Oh, I'm sorry about that. There are some things that work in cells but not CF and I did not consider that an array would not work.

The best I can do is this:

=LET(Xtime,TEXT(XLOOKUP($DD1,$CG$6:$CG$205,$CE$6:$CE$205,"",0,1),"h:mm"),OR(Xtime="5:15",Xtime="5:00"))
 
Upvote 0
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,151
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