Continuous numbers without gaps
=ARRAYFORMULA(IF(B2:B="","",MATCH(ROW(B2:B),FILTER(ROW(B2:B),B2:B<>""),0)))Counts only filled rows.
Generate row numbers only when the row contains data.
Generate row numbers only when the row contains data. Use =ARRAYFORMULA(IF(B2:B="","",ROW(B2:B)-ROW(B2)+1)), then replace the sample ranges with the columns in your sheet.
ROW creates the sequence; IF leaves unused rows empty.
| A | |
|---|---|
| 1 | Task |
| 2 | |
| 3 | |
| 4 | |
| 5 |
=ARRAYFORMULA(IF(B2:B="","",MATCH(ROW(B2:B),FILTER(ROW(B2:B),B2:B<>""),0)))Counts only filled rows.
=SEQUENCE(COUNTA(B2:B))Creates a compact list from 1 to the count.
=ARRAYFORMULA(IF(B2:B="","",ROW(B2:B)-ROW(B2)+1001))Uses a custom starting number.
Test B2:B="" rather than COUNTA when source formulas return empty text.
Use the array formula rather than typed numbers.
Test B2:B="" rather than COUNTA when source formulas return empty text.
Use the array formula rather than typed numbers.
Send this recipe to the SheetSteps assistant and describe how your columns are arranged.