How to Use Excel MATCH to Find the First Occurrence After a Specific Row
Question details
The user needs to find the first occurrence of a specific subcategory that appears strictly after a defined category row in a dataset with repeating groups.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Locating a specific value in a column where the value appears multiple times, but the correct instance only occurs after another specific condition or row index is met.
- Observed behavior
- The standard MATCH function only returns the very first occurrence in the entire range, ignoring whether the match falls under the correct category or row.
Ensure your dataset is organized consistently in a single column and identify the exact cell references for the category and subcategory you want to search for.
Use a Conditional Array Formula with MATCH and ROW
This method combines the MATCH and ROW functions into a conditional array formula, evaluating both the cell value and its row position simultaneously.
By multiplying two conditions together—one checking for the exact subcategory text and another checking if the row number is greater than the row of the main category—you can force Excel to only consider matches that occur after your target row.
Assume your categories and subcategories are mixed in column C (e.g., C1:C1000). Place the target category name you want to search after in cell G1, and the target subcategory name you want to find in cell H1.
Select an empty cell where you want the result to appear and type the following formula: =MATCH(1,(C1:C1000=H1)*(ROW(C1:C1000)>MATCH(G1,C:C,0)),0)
If you are using an older version of Excel that does not support dynamic arrays, do not just press Enter. Instead, press Ctrl+Shift+Enter to confirm the formula. Excel will wrap the formula in curly braces {}.

Master Data Search and Formulas with WPS Office
WPS Spreadsheet fully supports complex array formulas, including MATCH and ROW combinations. You can seamlessly analyze, search, and manage categorized data using exactly the same formulas you would use in Excel.
- 1. Open WPS Spreadsheet: Launch WPS Office and open your workbook containing the categorized data.
- 2. Input the Formula: Click on the cell where you want the result, and enter the MATCH and ROW array formula exactly as provided.
- 3. Execute the Search: Press Enter (or Ctrl+Shift+Enter for array evaluation) to instantly get the correct row position of your subcategory.

Frequently Asked Questions
Why is my MATCH formula returning a #N/A error?
A #N/A error usually means the exact value was not found. Ensure there are no leading or trailing spaces in your cells. Additionally, if you are using an older spreadsheet version, make sure you confirmed the formula with Ctrl+Shift+Enter so it evaluates the array correctly.
How can I return the actual cell value instead of the row number?
The MATCH function only returns the relative position (row number) of the item. To return the actual value from another column on that same row, wrap your MATCH formula inside an INDEX function, like =INDEX(D1:D1000, MATCH(...)).
Do I always need to press Ctrl+Shift+Enter for this formula?
It depends on your software version. Newer versions of Excel (Microsoft 365) and modern spreadsheet tools with dynamic array support evaluate array formulas automatically just by pressing Enter. In older versions, Ctrl+Shift+Enter is mandatory.




