• 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.

Count of Consecutive Days OFF Formula

Enan Bahadur

New Member
81519
Dear Excel Guru's
Kindly need your help to get the consecutive 02 days OFF and 04 days OFF count for my staff roster separately.
I want to get the values as shown in green cell.
Attached excel file is for your reference and above image as well.
 

Attachments

how about
for 2
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=2,1))
for 4
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=4,1))

Not sure what version of excel you have - but may need
CONTROL+SHIFT+ENTER..


Just change the number 2 to 4 to mark the amount you want
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=2,1))

NOT sure it will work for all possible

the face is : and a P
so D4 : P4
Moderator note: You could use Inline code to avoid that.
 

Attachments

Last edited by a moderator:
how about
for 2
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=2,1))
for 4
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=4,1))

Not sure what version of excel you have - but may need
CONTROL+SHIFT+ENTER..


Just change the number in red to the amount you want
=SUM(IF(FREQUENCY(IF(D4:p4="OFF",COLUMN(D4:p4)),IF(D4:p4<>"OFF",COLUMN(D4:p4)))=2,1))

NOT sure it will work for all possible

the face is : and a P
so D4 : P4

Thanks a lot ETAF, It is working perfectly.
 
ok, thats how it works, just away anything more - may cause issues i did not fully test ver lots of data - just the sample you supplied
 
Back
Top