How to "match" or "search" multiple/partial text values out of sequential order and still work

wbstadeli

Board Regular
Joined
Mar 11, 2016
Messages
151
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

Is there any way to search a cell for text words that the words do not have to be in order? I can get this formula to work using if everything i type is in the exact order, but not if i try to switch some words around.

Formula using search: =isnumber(search(trim(C1),A1))

See example:
ABC
1the dog runs fastdog runs
2

<tbody>
</tbody>

This returns a "True", however see next example:


ABC
1the dog runs fastruns dog
2

<tbody>
</tbody>


This returns "False".

Anyway to get this to be true? Im open to helper columns if needed as well. Thanks for looking!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
How many words would be in C? If more than two, you may want to try VBA.

You can use the following two string functions to get "runs" and "dog".

=LEFT(C1,FIND(" ",C1)) <- for "runs"
=RIGHT(C1,LEN(C1)-FIND("dog",C1)+1) <- for "dog"

=IF(AND(ISNUMBER(SEARCH(LEFT(C1,FIND(" ",C1)),A1)),ISNUMBER(SEARCH(RIGHT(C1,LEN(C1)-FIND("dog",C1)+1),A1))),"TRUE","FALSE")
 
Upvote 0
How many words would be in C? If more than two, you may want to try VBA.

You can use the following two string functions to get "runs" and "dog".

=LEFT(C1,FIND(" ",C1)) <- for "runs"
=RIGHT(C1,LEN(C1)-FIND("dog",C1)+1) <- for "dog"

=IF(AND(ISNUMBER(SEARCH(LEFT(C1,FIND(" ",C1)),A1)),ISNUMBER(SEARCH(RIGHT(C1,LEN(C1)-FIND("dog",C1)+1),A1))),"TRUE","FALSE")

Thanks yky, i apologize i wasn't very clear with my post. The words/ numbers would be variable, so i cant have anything the finds the actual word (example; "dog" or "runs", rather "anyword" or "anynumber"), if that makes sense. Thanks for your reply though!
 
Upvote 0
You can substitute "dog" with the first formula to get the following:

=IF(AND(ISNUMBER(SEARCH(LEFT(C1,FIND(" ",C1)),A1)),ISNUMBER(SEARCH(RIGHT(C1,LEN(C1)-FIND(LEFT(C1,FIND(" ",C1)),C1)+1),A1))),"TRUE","FALSE")

As you can see, with only two words, the formula is already so long. With more than two words, you need to find other solutions such as VBA.
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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