spill-the-beans
Board Regular
- Joined
- Feb 7, 2013
- Messages
- 52
Hello,
I was wondering if it is possible to count the occurrence of a specific series relative to other cell values. . .
My dataset has two relevant columns, G and H. The data are 1s and 0s. If G=1 then H=0 and vice versa. Alternatively, both G and H can = 0 at the same time.
What I would like to be able to do is count the number of double 0s after the first time G=1 and H=0, but before the first time G=0 and H=1.
so, the cells to count are in red below. Note that the answer should be 3 (the number of times a 0 occurs in both columns at the same time), not 6 (the number of double 0s between the criteria). Also, the very last double 0 row should not be in the count, because H has been 1 before the occurrence of that double 0.
[TABLE="width: 500"]
<tbody>[TR]
[TD]G
[/TD]
[TD]H
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
</tbody>[/TABLE]
Any help would be gratefully received, thank you
I was wondering if it is possible to count the occurrence of a specific series relative to other cell values. . .
My dataset has two relevant columns, G and H. The data are 1s and 0s. If G=1 then H=0 and vice versa. Alternatively, both G and H can = 0 at the same time.
What I would like to be able to do is count the number of double 0s after the first time G=1 and H=0, but before the first time G=0 and H=1.
so, the cells to count are in red below. Note that the answer should be 3 (the number of times a 0 occurs in both columns at the same time), not 6 (the number of double 0s between the criteria). Also, the very last double 0 row should not be in the count, because H has been 1 before the occurrence of that double 0.
[TABLE="width: 500"]
<tbody>[TR]
[TD]G
[/TD]
[TD]H
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]1
[/TD]
[/TR]
[TR]
[TD]0
[/TD]
[TD]0
[/TD]
[/TR]
</tbody>[/TABLE]
Any help would be gratefully received, thank you
