Highlight text in column 1 based on a range of words* in column 2

gdekker

New Member
Joined
Sep 10, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Data:
Column G with course names, Column S with a subset of those courses. I would like to highlight every course in G that matches the partial words in S.

I kind of have it solved already by using 2 rules (since the outlier has a different, simpler naming scheme), but this should be possible (and imho is more elegant) with 1.

I'm currently using 2 conditional formatting rules:
=COUNTIF($S$2:$S$200,G2)>0 <- highlights every course in G that matches any course in S exactly
and
=SEARCH("CourseX1-", G2)>0 <- highlights any course in G that starts with 'CourseX1-'

Unfortunately, the search does not work on a range (so "=SEARCH($S$2:$S$200, G2)>0" doesn't work).

The simplest solution would be a rule that would highlight every word in G that starts with any of the words in S. I would think this wasn't that hard, but I can't figure it out. Can anyone help out?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The simplest solution is to use a conditional formatting rule where the text contains what you are looking for.
 
Upvote 0
Hi & welcome to MrExcel.
Do you have any blank cells in S2:S200?
 
Upvote 0
The simplest solution is to use a conditional formatting rule where the text contains what you are looking for.

Thanks for the suggestion, but that is not a simple solution. Dozens of these courses have different naming schemes, I'd have to make dozens of rules. (Note: I want all courses in G highlighted the same color. In your example 1 rule would suffice: "cell value contains 'CourseX'"; one of the 2 rules I have already does exactly that "=SEARCH("CourseX", G2)>0")

Do you have any blank cells in S2:S200?
Not necessarily. (That is: I will add and remove items every now and then, but I can adjust the '200' to the last item's cell number.)

There has to be a simple solution that checks if 'word in colum G (equals or) starts with word in column S'?
 
Upvote 0
Ok, how about
Excel Formula:
=OR(COUNTIF($S$2:$S$200,G2),SUM(COUNTIFS(G2,$S$2:$S$200&"*")))
But this will not work if you have blanks in col S
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,259
Messages
6,177,485
Members
452,782
Latest member
ZCapitao

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