# Thread: [SOLVED] Excel on off count

1. ## [SOLVED] Excel on off count

Hey guys
I basicly have a column of 1s and 0s(on and off), and i need to know the total number of times the machine starts, including the first time.
The machine starts every time the data switches from a 0(or group of 0s) to a 1.
How would i go about writing an equation(probly containing the IF command) to count these iterations?

Cheers.

2. Do you have an example of the data you can upload?

3. im not sure how to put the file in, but heres a simplified version:

1
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
1
1
1
0
1

Theres four times that it is switched on in that set by my count, the real set has thousands of data

4. I got 6 switches in that set you posted, and if you agree with 6 i might have a solution to your problem

5. I only want when it switches to on, or from off to on, here are my switches:

HERE
1
1
1
1
1
1
1
0
0
0
0
0
0
HERE
1
1
1
0
0
0
0
HERE
1
1
1
1
1
0
HERE
1

6. Originally Posted by deragon999
I only want when it switches to on, or from off to on, here are my switches:

HERE
1
1
1
1
1
1
1
0
0
0
0
0
0
HERE
1
1
1
0
0
0
0
HERE
1
1
1
1
1
0
HERE
1

alright sorry I didn't realize you only wanted switching from 0 to 1,

So let's say your list starts in the cell A1,

use this function is a cell =IF(AND(A1=0,A2=1),1,0) and drag it down

Then at the bottom of the collum, make one cell equal to the sum of the column =Sum(A1:A_n) and then add 1 to that number if your number in A1 is a 1, don't add 1 if it's a 0 in A1

7. you could always just put a 0 in first if your first number is a 1, and then not worry about the adding 1 to the sum business

8. Thank you very much for all you help, i got the right results so alls good