Check Whether a Drug Description Contains an NSAID Name in Excel
Question details
Check each drug description for any name in an NSAID list and return 1 for a match or 0 for no match.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Drug descriptions are listed in a worksheet, and the user wants to flag descriptions containing names such as ibuprofen, naproxen, or diclofenac.
- Observed behavior
- Each description should receive a numeric flag indicating whether it contains at least one listed NSAID name.
Place the NSAID names in a contiguous range with no blank cells, and confirm which column contains the drug descriptions. The example below uses B4 for the first description.
Use SEARCH with a named NSAID list in Excel
Search each description against all names in a named range and return a numeric match flag.
SEARCH is case-insensitive and looks for text anywhere in the description. It can match a name inside a longer word, so review results if exact drug-name boundaries matter.
Enter one drug name per cell, for example in E2:E4. Select the populated cells, type nsaids in the Name Box to the left of the formula bar, and press Enter.
In C4, enter =--(SUM(IFERROR(SEARCH(nsaids,B4),0))<>0) and press Enter. In older Excel versions, confirm it with Ctrl+Shift+Enter instead.
Drag the fill handle from C4 down alongside the remaining descriptions. Each row returns 1 if at least one listed name is found, or 0 otherwise.

Flag NSAID names in WPS Spreadsheet
Use a SEARCH formula in WPS Spreadsheet to check descriptions against a list of NSAID names and fill the results down your worksheet.
- 1. Open the worksheet: Open your workbook in WPS Spreadsheet and locate the column containing the drug descriptions.
- 2. Enter the list: Enter the NSAID names in E2:E4, one name per cell, without leaving blank cells.
- 3. Add the formula: In C4, enter =--(SUM(IFERROR(SEARCH($E$2:$E$4,B4),0))<>0) and confirm the formula.
- 4. Apply it to other rows: Drag the fill handle from C4 down the result column. A 1 indicates at least one list match; a 0 indicates no match.

Frequently Asked Questions
Does SEARCH distinguish between uppercase and lowercase drug names?
No. SEARCH is case-insensitive, so a list entry such as ibuprofen also matches Ibuprofen in a description.
Why does every row return 1?
Check the NSAID list for blank cells. SEARCH treats an empty search term as a match, so select only populated cells when defining the nsaids range.
Can the formula find more than one NSAID in a description?
Yes. It searches for every name in the list, but returns only 1 if one or more names are found, rather than counting or identifying the matches.
Will the formula match a drug name inside a longer word?
Yes. SEARCH finds substrings anywhere in the description. Review potential partial-word matches if you need exact drug-name boundaries.
How do I add another drug to the named list?
Enter the name in a cell adjacent to the list, then open Formulas > Name Manager and edit the nsaids range to include that cell.




