I want to do some calculation in Excel.

```
A B
1 0 1
2 1 0
3 0 4
4 0 3
5 0 2
6 0 1
7 1 0
8 0 2
9 0 1
10 1 0
```

The cell in column B is `the row number of cell A if it is 1`

- `current cell row number`

. How to set up this formula if there are many `1`

in column A? (After `1`

in column A the formula should reset I believe)

`1`

in column A, the formula should be`the row number which has value of 1 in column A`

-`current row number`

– Vahn Jul 1 '17 at 21:39`1`

in column A is on A7, then row(A7) - row(B3) so on until row(A7) - row(B7) which result is 0. then the formula reset again until find the next`1`

in column A. Is this possible? – Vahn Jul 1 '17 at 21:42