Fix Excel SEARCH Formula References and Range Errors
Question details
The user needs to correct a SEARCH formula that gives unexpected results when copied down a table.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Search each row for a term and assign a number to matching rows.
- Observed behavior
- The search-term reference changes when the formula is filled down, and SEARCH is applied to an entire range instead of the current row's cell.
Identify the cell containing the search term, the column to search, and the output column. In the example below, the term is in B2, the target cells start at J2, and results start in L2.
Lock the search term and search one cell per row
Use this formula when every row should be checked against the same search term in B2.
The absolute reference $B$2 stays fixed when the formula is copied down, while J2 changes to J3, J4, and so on. The expanding MAX range numbers matching rows based on earlier results.
Enter the term to find in cell B2. Avoid leaving B2 empty, because SEARCH treats an empty string as a match.
Select L2 and enter =IF(ISNUMBER(SEARCH($B$2,J2)),MAX($L$1:L1)+1,0).
Drag the fill handle from L2 down the output column. Each row searches its own cell in column J and returns 0 when there is no match.
Review the references in MAX($L$1:L1) if your output starts in another row or column. Keep the range limited to cells above the formula to avoid a circular reference.

Correct SEARCH references in WPS Spreadsheets
Use WPS Spreadsheets to lock a search-term reference, search each row's target cell, and fill the corrected formula down.
- 1. Open the workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook.
- 2. Enter the search term: Enter the term to find in B2 and confirm that the cells to search begin in J2.
- 3. Add the formula: Select L2 and enter =IF(ISNUMBER(SEARCH($B$2,J2)),MAX($L$1:L1)+1,0).
- 4. Fill and check: Drag the fill handle down column L, then check that matches are numbered and nonmatches return 0.

Frequently Asked Questions
Why does B2 change to B3 when I copy the formula?
B2 is a relative reference. Use $B$2 in the formula to keep the search term fixed as you fill down.
What if each row has a different search term?
Use B2 instead of $B$2. When you fill the formula down, the reference changes to B3, B4, and so on.
Why should I use J2 instead of J2:J33 in SEARCH?
For a row-by-row result, J2 checks the target cell on the current row. A range can produce multiple results or spill behavior depending on the Excel version and formula context.
Is SEARCH case-sensitive?
No. SEARCH ignores letter case. Use FIND instead of SEARCH if the match must be case-sensitive.
Why does the formula return 0?
The formula returns 0 when ISNUMBER does not find a numeric SEARCH result, usually because the term is not present in the target cell. Check B2 and the corresponding cell in column J.




