search multiple text strings in a cell

joecast

Board Regular
Joined
Mar 4, 2010
Messages
52
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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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")
 
Upvote 0
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
 
Upvote 0
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).
 
Upvote 0
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")
 
Upvote 0

Forum statistics

Threads
1,224,588
Messages
6,179,743
Members
452,940
Latest member
rootytrip

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