Conditional formatting for multiple partial matches

gli

Board Regular
Joined
Jun 8, 2006
Messages
96
Hello all,

I know I can use conditional formatting for each partial text string I want to effect by using SEARCH, but that would be a lot of single rules and time consuming to implement. I'm looking for a formula that will find any instance of a list of several partial text strings and apply the same format to them.

I have a column about 3000 rows deep with a series of text strings. The text strings start with letters and end with numbers (ex: YY5725 or B7890). The numbers are not important for my needs here, just the letters. These letters will repeat based on the type of record involved. I am looking for a conditional formatting formula that will for example find every instance of B, XX, YY, and ZZ and turn those cells the color I want to use. The formula needs to be able to ignore the numbers and just focus on the letters, which I will define.

Any help would be greatly appreciated, but I am hoping for a non-VBA solution.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Here is one way. Enter the relevant partial texts in a vacant column (I've used col D) then use Conditional Formatting (formula) as shown.

Excel Workbook
ABCD
1DataB
2YY5727XX
3JK45YY
4AB7895ZZ
5RZZ678
6
7FTR908
8XXT675
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A8Expression=COUNT(SEARCH(D$1:D$4,A2))textNO
 
Last edited by a moderator:
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,182
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