# search multiple text strings in a cell

#### joecast

##### Board Regular
hello all,
have this formula working:

Code:
``=IF(ISERROR(SEARCH("PS",Table_Query_from_NAV[[#This Row],[No_]])),VLOOKUP(Table_Query_from_NAV[[#This Row],[No_]],Facility_Table,4,TRUE),"Linear Asset Type")``

which is great, however, now i need to search for two other text strings. i have tried using OR, but may not be trying it in the right place or in the right way. so basicallyinstead of just searching "PS", i need to search "PS", "MH" or "SEG", and possibly others later on. any suggestions? thanks
joe

### Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Joe

Perhaps:

=IF(SUM(COUNTIF(Table_Query_from_NAV[[#This Row],{"*PS*","*MH*","*SEG*"})),Vlookup(Table_Query_from_NAV[[#This Row],[No_]],Facility_Table,4,TRUE),"Linear Asset Type")

thanks Richard,
the countif is only giving a result for the first value "*PS*", the others are not registering. tried switching the arguments, but only first one works. have seen
{"*PS*","*MH*","*SEG*"}
used but dont understand the logic so cant tell if it should work for countif. im guessing it is doing a rough OR kind of thing? thanks
joe

I did get the logic round the wrong way - think it should have been:

=IF(SUM(COUNTIF(Table_Query_from_NAV[[#This Row],{"*PS*","*MH*","*SEG*"}))=0,Vlookup(Table_Query_from_NAV[[#This Row],[No_]],Facility_Table,4,TRUE),"Linear Asset Type")

However, as far as I know that should work (although I don't have 2007 or 2010 to test on Table ranges I'm afraid).

YEEEES!!
thats got it! didnt reralise it was a CSE formula. Thanks
joe

=IF(SUM(COUNTIF(Table_Query_from_NAV[[#This Row],[No_]],{"*PS*","*MH*","*SEG*"}))=0,VLOOKUP(Table_Query_from_NAV[[#This Row],[No_]],Facility_Table,4,TRUE),"Linear Asset Type")

It's not a CSE formula

Replies
1
Views
304
Replies
2
Views
387
Replies
2
Views
378
Replies
6
Views
176
Replies
13
Views
481

1,203,396
Messages
6,055,161
Members
444,766
Latest member
bryandaniel5

### 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.

### Which adblocker are you using?

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

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