• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Stop counting where 0 is found in a row out of 20 cells

KapardhiSarma

New Member
Hi Team,

I have a requirement that in a row of 20 cells if the 1st cell is 0 it should show as 0, and if the number is 1 it should start counting till it find 0 by end of all 20 cells in a row.

Attaching an example for your reference.
Explained in column 'W' of the attachment about the end result.

Thanks a lot for your help in advance.
 

Attachments

  • Count Example.xlsx
    16.3 KB · Views: 7
Hi Kapardhi,

Try below array formula in W2 and copy down:

=IF(A2=0,0,IF(A2=1,COUNT(OFFSET(A2,,,,MIN(IFERROR(MATCH(0,A2:V2,0)-1,999999),SUM(IF(A2:V2<>0,1,0)))))))

Enter with Ctel+Shift+Enter.

Regards,
 
@Debraj dada

would like to modify your formula for the case where there is no 0's and all 1, based on the data in sample file with only 1 & 0's.

=IFERROR(MATCH(0,$A2:$V2,0)-1,COUNT($A2:$V2))

Regards,
 
@KapardhiSarma

If both formula works for you than please use @Debraj formula, as it is clean, easy and do not uses any volatile function which will make it faster.

@Somendra Misra

You need to start doing Excel Yoga to free your mind. "There is no Complexity" on the similar line of "There is no spoon from MATRIX" :)

Regards,
 
Back
Top