'Excel formula for counting the number of rows away from TRUE event in another column [closed]
I have an Excel table that looks like this;
The cells in the column Number of rows away from occurrence counts the number of rows that are away from a TRUE event in Occurrence column.
I would like to have a formula for the cells in column Number of rows away from occurrence.
I am using Microsoft Excel 2019.
Solution 1:[1]
I think this formula in the 2nd column would work:
=IF(A2, 0, SUM(B1, 1))
Copy and paste to all rows in that column. The function looks to see if the current row has a TRUE in the first column. If it does, it sets it to zero. Otherwise, it adds 1 to the value in the previous row of the 2nd column.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

