Is there a shorter way without having to repeat a Conditional Formatting formula?

arthurz11

Board Regular
Joined
Nov 9, 2007
Messages
162
Office Version
  1. 2021
Platform
  1. Windows
Picture3.gif
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Formula
Excel Formula:
=SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0

Applies to:
Excel Formula:
I2:J4


$scratch.xlsm
ABCDEFGHIJKLM
1
2-107-10,7-20,11-4
3-52-5,2-10,5-0-52
45115,11-3-5,0-5-50
552
65-2
705
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:J4Expression=SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0textNO
 
Upvote 0
Solution
Formula
Excel Formula:
=SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0

Applies to:
Excel Formula:
I2:J4


$scratch.xlsm
ABCDEFGHIJKLM
1
2-107-10,7-20,11-4
3-52-5,2-10,5-0-52
45115,11-3-5,0-5-50
552
65-2
705
CF
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:J4Expression=SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0textNO
I really appreciate your help in your time and effort. =SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0 The formula works beautifully!!!
 
Upvote 0
Using COUNTIF may help code neater
Code:
=OR(COUNTIF(I2,$L$3:$L$7&","&$M$3:$M$7&"-*")>0)
Book1
IJKLM
2-10,7-20,11-4
3-5,2-10,5-0-52
45,11-3-5,0-5-50
552
65-2
705
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:J4Expression=OR(COUNTIF(I2,$L$3:$L$7&","&$M$3:$M$7&"-*")>0)textNO
 
Upvote 1
I really appreciate your help in your time and effort. =SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0 The formula works beautifully!!!
By the way, I didn't test it with the expanded columns. I have 150 columns. So if I use your formula: =SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0. I have to repeat for each pair of columns if I add additional columns. That means I still have to repeat the formula over and over again until I have written 75 formulas. For Example:
=SUM(IFERROR(MATCH($L$3:$L$7&","&$M$3:$M$7&"-*",I2,0),0))>0
=SUM(IFERROR(MATCH($N$3:$N$7&","&$O$3:$O$7&"-*",I2,0),0))>0
=SUM(IFERROR(MATCH($P$3:$P$7&","&$Q$3:$Q$7&"-*",I2,0),0))>0
=SUM(IFERROR(MATCH($R$3:$R$7&","&$S$3:$S$7&"-*",I2,0),0))>0

and so on...I mean, it will work fine and it will highlight the x,y coordinates that meets the condition. But it's the only way, correct?
Picture1.png
 
Last edited:
Upvote 0
By the way, I didn't test it with the expanded columns. I have 150 columns.
If you don't explain your entire problem in your first post, you won't get an entire solution. I'm guessing there is some way to do this but it's not obvious. I'll have another look.
 
Upvote 0
What are the factors that led to that layout? Why do you need 150 columns instead of 2?
 
Upvote 0
What are the factors that led to that layout? Why do you need 150 columns instead of 2?
I tried figuring it out with one formula and it was difficult. So I decided to create 75 conditional formulas UNTIL your question gave me an idea. I'm going to use the =Cell & number to just create only two columns. That would be much easier and I just have one Conditional Formula. Thank you!
 
Upvote 1

Forum statistics

Threads
1,224,076
Messages
6,176,239
Members
452,715
Latest member
DebbieCox

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