Search two or more non-consecutive words in a work sheet or column

Excel_User_1

New Member
Joined
Nov 2, 2012
Messages
2
Hi,
I have thousands of cells in a column and each cell contains long sentences (string). I have to search for a cell that contain two non-consecutive words in a sentence. Note that there may be more sentence with same words either consecutive or non-consecutive.
For example, one cell contain a sentence "You can post a new question by selecting one of the forums below".
If I use the built-in Find (Ctr+F) function and search the words "new" and "forums" then Excel cannot find it because the words are non-consecutive, they are separated by other words.
Is there any way we can find the cells with two words that are in a give sentence but not together? Any macro?

Your help will be appreciated much.
Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Maybe something like this

=SEARCH(" "&C2&" "&"*"&" "&D2&" "," "&A2&" ")
where C2 houses new and D2 houses forums

M.
 
Last edited:
Upvote 0
Sorry, the formula above fails if the words are consecutive and separated by one space

Try this new version

=OR(ISNUMBER(SEARCH(" "&$C$2&" "&"*"&" "&$D$2&" "," "&A2&" ")),ISNUMBER(SEARCH(" "&$C$2&" "&$D$2&" "," "&A2&" ")))

M.
 
Last edited:
Upvote 0
Thanks Marcelo,
While this formula works beautifully, I was interested in something like the Find function of Excel that will bring a dialog box to enter the word that need to be searched and once a cell is found with the desired word it will directly take you to that cell.
 
Upvote 0

Forum statistics

Threads
1,216,108
Messages
6,128,872
Members
449,475
Latest member
Parik11

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