In Google Sheets, how can I create an ARRAYFORMULA to generate sequential numbering in column B, only when adjacent C cell is not empty?
- I want to start sequential numbering from B10,
- If a cell in column C is blank, numbering in B cell be skipped, and then it continues from the next non-empty C cell.
Example:
| Column B | Column C |
|---|---|
| 1 | apple |
| 2 | mango |
| | |
| 3 | orange |
| 4 | peach |
I have found formulas for sequential numbering that ignore blank cells in the adjacent column, but these formulas need to be dragged down whenever new rows are added. I want to use ARRAYFORMULA so that it applies automatically to the entire range.
I tried using this formula generated by Claude:
=ARRAYFORMULA(IF(C10:C<>"", ROW(C10:C) - ROW(C10) + 1, ""))
This formula returns a blank in B cell when the adjacent C cell is empty, but it continues the numbering. So, in the table, it would show 4 - oranges , and , 5 - peach.




