# How to return the row number of a matching value in Excel

Add the first row's offset to MATCH: `=MATCH(F1,A2:A9,0)+ROW(A2)-1` gives the sheet row of the match.

**Excel:** `=MATCH(F1,A2:A9,0)+ROW(A2)-1` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E | F |
| --- | --- | --- | --- | --- | --- |
| Invoice | Customer | Amount |  | Invoice | INV-1047 |
| INV-1043 | Contoso | 1250 |  | Sheet row |  |
| INV-1044 | Fabrikam | 640 |  |  |  |
| INV-1045 | Northwind | 2180 |  |  |  |
| INV-1046 | Litware | 395 |  |  |  |
| INV-1047 | Adatum | 1720 |  |  |  |
| INV-1048 | Contoso | 860 |  |  |  |
| INV-1049 | Proseware | 1475 |  |  |  |
| INV-1050 | Fabrikam | 930 |  |  |  |

Formula in F2: `=MATCH(F1,A2:A9,0)+ROW(A2)-1`

Result: 6

## How it works

MATCH returns the position inside `A2:A9`: INV-1047 is 5th. The range starts in row 2, so `ROW(A2)-1` adds the one row above it and the result is sheet row 6. Writing the offset with ROW keeps the formula right if the list moves.

## Other ways

- `=MATCH(F1,A:A,0)`: Searching the whole column gives the sheet row directly, as long as nothing above the list could match.
- `=XLOOKUP(F1,A2:A9,ROW(A2:A9))`: Returns the row from a list of row numbers. Excel 2021, Microsoft 365 and Google Sheets.

## Common mistakes

- MATCH on its own gives the position in the range, not the row. Forgetting the offset is off by one for every header row.
- With duplicates you get the first row. Use `XMATCH(F1,A2:A9,0,-1)+ROW(A2)-1` for the last one.

## Questions

**How do I get the row number for two criteria?**

Match 1 against multiplied tests: `=MATCH(1,(A2:A9=F1)*(B2:B9="Adatum"),0)+ROW(A2)-1`.

**How do I get every row number that matches?**

Filter the row numbers: `=FILTER(ROW(A2:A9),B2:B9="Contoso")`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/row-number-of-matching-value
