Search Conditional formatting exact match

JMWh1t3

New Member
Joined
Aug 5, 2022
Messages
16
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hiya All,

I have the following formula set in Conditional formatting to highlight the entire row when the town Aston is present.

Excel Formula:
=SEARCH("Aston",$G1)

The issue I have is it also highlights cells that contain words with "aston" in them i.e. Glastonbury.

Is there a way to stop this?

Thanks in Advance! :-)
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
What column contains the town(s)? Is there any other text/data in those cells with the town(s)?
 
Upvote 0
What column contains the town(s)? Is there any other text/data in those cells with the town(s)?
Towns are in column G:G. and there is only towns in the column, but may have multiple towns in one cell formatted as follows "Town1 / Town2 / Town3 / Town4" anywhere from 1 to 6 towns.
 
Upvote 0
Hm, well it seems the solution I was going to suggest is not allowed as a CF formula. Is it an option to use a helper column?

If it is an option, you can try this, then check the helper column for value greater than 0:
Book1
FG
11ASTON / BIRCHFIELD / GIB HEATH
20GASTONBURY
31ASTON
Sheet2
Cell Formulas
RangeFormula
F1:F3F1=SUM(--BYCOL(TEXTSPLIT(G1," / "),LAMBDA(t,EXACT("ASTON",t))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F1:G3Expression=$F1>0textNO
 
Upvote 0
Hm, well it seems the solution I was going to suggest is not allowed as a CF formula. Is it an option to use a helper column?

If it is an option, you can try this, then check the helper column for value greater than 0:
Book1
FG
11ASTON / BIRCHFIELD / GIB HEATH
20GASTONBURY
31ASTON
Sheet2
Cell Formulas
RangeFormula
F1:F3F1=SUM(--BYCOL(TEXTSPLIT(G1," / "),LAMBDA(t,EXACT("ASTON",t))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F1:G3Expression=$F1>0textNO
I like this solution, but cannot use a helper column unfortunately.
 
Upvote 0
Hiya All,

I have the following formula set in Conditional formatting to highlight the entire row when the town Aston is present.

Excel Formula:
=SEARCH("Aston",$G1)

The issue I have is it also highlights cells that contain words with "aston" in them i.e. Glastonbury.

Is there a way to stop this?

Thanks in Advance! :)
Replace SEARCH with FIND. FIND is case sensitive.
 
Upvote 1
Solution
If your delimiters are consistent:

Excel Formula:
=SEARCH(" / Aston / "," / "&$G1&" / ")
 
Upvote 0

Forum statistics

Threads
1,223,879
Messages
6,175,150
Members
452,615
Latest member
bogeys2birdies

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