Identify variable within comma separated list, without wildcards (Chester <> Chesterfield / Manchester)

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
790
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Got a quandary here. I'm taking a customer pickup as variable, using Chester as an example, and searching for a match within a comma separated list of pickups which may look like this:

VBA Code:
Chichester, Bognor Regis, Littlehampton, Worthing, Shoreham-by-Sea, Hove, Brighton, Horsham, Pease Pottage Services (M23), Crawley, Horley

I'm searching a large set of data using filters and holding "Chester" as the variable, unfortunately it will show a match for any string that contains *Chester* - including Chichester, Manchester, Chesterfield etc

Any ideas how to search for -just- Chester? In the past I've tried searching for "* Chester*" but obviously this would still count Chesterfield, so you'd think "* [Pickup],*" would work, but this would not work when the pickup needed is at the start or end of the string.

Thank you!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hey, try this:

NCT_Mapping_Doc.xlsx
AB
1Manchester is big 
2Chesterfield is small 
3Chester is okFlag
4is chester small?Flag
5is it chesterFlag
Sheet6
Cell Formulas
RangeFormula
B1:B5B1=IF(IFERROR(SEARCH(" chester "," "&A1&" "),0)>0,"Flag","")
 
Upvote 0
Assuming that this is VBA, can you please post the relevant code?
 
Upvote 0
Assuming that this is VBA, can you please post the relevant code?

VBA Code:
Range("A2:AF" & pplastrow).AutoFilter Field:=11, Criteria1:="=*" & pup & "*"

Essentially this is how the filter operates. Cheers.
 
Upvote 0
If you have a load of comma separated string in col K, then you will not be able to use AutoFilter to just show rows that contain Chester, but not Manchester etc.
 
Upvote 0

Forum statistics

Threads
1,215,156
Messages
6,123,339
Members
449,098
Latest member
thnirmitha

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