I have this Formula:

=ROW()-MATCH(LOOKUP(2,1/(D$1:INDIRECT("D" & ROW() -1)<>""),D$1:INDIRECT("D" & ROW() -1)),D$1:INDIRECT("D" & ROW() -1),0)

In order to speed up counting days between events, it simply finds the last non empty cell above it and subtracts its row value from the row value before the current cell. It was going fine for about a month and then suddenly I started getting random numbers.

[Example of random data](https://i.stack.imgur.com/KyWsy.jpg)

The 730 was the first error I hit so I decided to spam the formula and see what my results are and as you can see they are quite inconsistent.

Any help at all would be greatly appreciated

Each cell has the proper column data input into the formula that is not the issue.