I am trying to find the amount of state changes in a row of 1s and 0s. So its a motor on and off and I am trying to figure out how many time the motor has started and stopped.
Every time the column changes from a 1 to a 0 or a 0 to a 1 I need a separate count for each.
The direction I have been trying to go with the formula is...
=COUNTIF(B2:B20,(=INDIRECT(ADDRESS,(ROW(B:B)-1,COLUMN(2:2)))))
what I want is something that is similar to this...
=COUNTIF(B2:B20, current cell is equal to 1 and above cell is equal to 0)
&
=COUNTIF(B2:B20, current cell is equal to 0 and above cell is equal to 1)
I just do not know how to write this but I will also take a better code (hopefully with an explanation of how it works).
I realize if I go with this I would probably need to add a new second row with a base value of 0 to count the first motor start.
If this has already been answered somewhere else I will gladly delete this post if I'm pointed in the right direction.
Bookmarks