How to check if a cell contains all of several words in Excel
Excel formula
=IF(COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3),"Yes","No")Count how many of the words are found and compare with the number of words: =IF(COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3),"Yes","No").
- Result on the example
- one result per row in
B2, filled down toB6 - Works in
- Every current version
- Google Sheets
- Different formula, see below
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
SEARCH returns a position for each word it finds and an error for each one it doesn't. COUNT counts only the numbers, so it is the number of words found. When that equals the number of words in the list (ROWS), every word is there.
=IF(COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3),"Yes","No")Result"Yes"
$D$2:$D$32 rows × 1 col: "oak", "desk"A range: 2 cells in one column.
A2"Oak standing desk, 140 cm"The value in A2.
SEARCH($D$2:$D$3,A2){2 rows × 1 col} 1, 14SEARCH: Position of text, not case-sensitive, allows wildcards.- find_text
$D$2:$D$32 rows × 1 col: "oak", "desk" - within_text
A2"Oak standing desk, 140 cm"
- find_text
COUNT(SEARCH($D$2:$D$3,A2))2COUNT: Counts cells that contain numbers.- value1
SEARCH($D$2:$D$3,A2){2 rows × 1 col} 1, 14
- value1
ROWS($D$2:$D$3)2ROWS: Number of rows in a range.- array
$D$2:$D$32 rows × 1 col: "oak", "desk"
- array
COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3)TRUEThe = operator tests whether the two sides are equal.
IF(COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3),"Yes","No")"Yes"IF: Returns one value if a test is true, another if false.- logical_test
COUNT(SEARCH($D$2:$D$3,A2))=ROWS($D$2:$D$3)TRUE - value_if_true
"Yes" - value_if_false
"No"not used
- logical_test
In Google Sheets
Google Sheets needs a different formula: =IF(SUMPRODUCT(--ISNUMBER(SEARCH($D$2:$D$3,A2)))=ROWS($D$2:$D$3),"Yes","No"). On the same data it gives the same result. Here it is running in Google Sheets mode.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =IF(AND(ISNUMBER(SEARCH($D$2:$D$3,A2))),"Yes","No") | Yes, No, Yes… | Excel 365: AND is TRUE only if every keyword was found. |
Common mistakes
- Words match inside longer words: "oak" is found in "soaked". Add spaces around the words if that matters.
- In Google Sheets, COUNT(SEARCH(range,…)) needs ARRAYFORMULA; the SUMPRODUCT version works without it.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Check if a cell contains all of several words
B2, show "Yes" only when the listing contains every word in D2:D3, and "No" otherwise. Fill down to B6.Questions
How do I check for any of the words instead?
Test for more than zero: =IF(COUNT(SEARCH($D$2:$D$3,A2))>0,"Yes","No").
How do I require at least two of three words?
Compare with 2: =COUNT(SEARCH($D$2:$D$4,A2))>=2.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.