Function Problems

Check Whether a Drug Description Contains an NSAID Name in Excel

Bushra ParveenBushra Parveen Nov 18, 2026 868 views

Question details

Check each drug description for any name in an NSAID list and return 1 for a match or 0 for no match.

Check Whether a Drug Description Contains an NSAID Name in Excel
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.
Before you start

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.

Solution 1Recommended

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.

1
Create the NSAID list

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.

2
Enter the formula

In C4, enter =--(SUM(IFERROR(SEARCH(nsaids,B4),0))<>0) and press Enter. In older Excel versions, confirm it with Ctrl+Shift+Enter instead.

3
Fill down

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.

Use SEARCH with a named NSAID list in Excel
Keep the list current: If you add names outside the named range, update nsaids through Formulas > Name Manager. Do not include blank cells, because SEARCH treats an empty search term as a match.
Work with formulas in WPS Spreadsheet

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. 1. Open the worksheet: Open your workbook in WPS Spreadsheet and locate the column containing the drug descriptions.
  2. 2. Enter the list: Enter the NSAID names in E2:E4, one name per cell, without leaving blank cells.
  3. 3. Add the formula: In C4, enter =--(SUM(IFERROR(SEARCH($E$2:$E$4,B4),0))<>0) and confirm the formula.
  4. 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.
Search descriptions for multiple NSAID names at onceReturn numeric 1 or 0 flags for filtering and reviewOpen and edit Microsoft Excel XLSX and XLS filesWork with a familiar spreadsheet interface
microsoft office alternative - wps office

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.