0

Is there a way to count how many times some number(zero in my case) occur before another number occurs in the same series in either minitab or ms excel(or any other statistical software)?

Eg: if I got 0 0 0 0 0 1 0 0 1 0 as the series I want to get the number of failures before the first success which is 5 because after 5 zeros 1(success) occurs.

2
  • Short answer: yes, anything of this nature can be done easily in Excel. How to give you what you need depends on the details. Does the series always begin with your target number? Are you always interested in the left-most numbers or in your example, might you be interested in the zeros that begin with the 7th digit? Can you create the series in any form you want (e.g., single multi-digit number vs. N cells each containing one digit)?
    – fixer1234
    Oct 11, 2014 at 3:28
  • Are you only interested in ones and zeros? (there are special techniques available if that is the case.) What order of magnitude number of digits could there be?
    – fixer1234
    Oct 11, 2014 at 3:32

1 Answer 1

0

Excel is perfect for this task. Place your data in column A
In B1 enter:

=IF(A1=0,"",ROW())

and copy down. Column B identifies each success.
In C1 enter:

=IFERROR(SMALL(B:B,ROW()),"")

and copy down.
In D1 enter:

=C1-1

In D2 enter:

=IF(C2="","",C2-C1-1)

and copy down. Cols C & D are the results table. C gives the location of each success and D gives the number of intervening failures. For example:

sample

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .