Check if series of values exist within a row array

tpcdoyle

New Member
Joined
May 11, 2017
Messages
1
Hi forum!

I don't believe I've posted on this before, however I've been stumped on this problem for a few days and any insight would be immensely appreciated :)!

I have a 3 week moving attendance data set which I update/audit weekly. There's 2 conditions which I audit for: (a) if an employee works a full week, do they at least have one day off? -or- (b) if an employee works 2 consecutive full weeks, do they have at least 2 consecutive days off? - the latter is the one I'm stumped on!!

The data set:

Emp#/D.O.M.123456789101112131415161718192021(a)(b)
1234111111101111111011111TRUETRUE
1235111111111111110011111FALSETRUE
1236111111111111111111111FALSEFALSE

<tbody>
</tbody>

Column W (a) checks for the first condition (which I have solved) however column X (b) is supposed to do check for the second condition; the first row (D.O.M.) contains the day of the month and the first column contains the employee number.

I have pseudo-code written for essentially what I'd like for output:

IF Series {1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0} Exists in Row Range (B2:V2) THEN TRUE ELSE FALSE etc.

I think that's all - let me know if I need to provide any additional info.

Thanks!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Welcome to the forum!

I have 2 options for you. Second option might be the best.

X2: =AND(MAX(FREQUENCY(IF(B2:V2=1,COLUMN(B2:V2)),IF(B2:V2=0,COLUMN(B2:V2))))>=14,MAX(FREQUENCY(IF(B2:V2=0,COLUMN(B2:V2)),IF(B2:V2=1,COLUMN(B2:V2))))>=2)
confirmed with Control+Shift+Enter.

This checks for a run of 14 1's, and a run of 2 0's, but not necessarily adjacent.

X2: =IF(SUM((SUBTOTAL(9,OFFSET(B2:O2,0,ROW(INDIRECT("1:6"))-1,1,14))=14)*(SUBTOTAL(9,OFFSET(B2:O2,0,ROW(INDIRECT("1:6"))+13,1,2))=0)),TRUE)
also with Control+Shift+Enter.

This is closer. It looks for a run of 14 1's, followed by 2 cells summing to 0.

Hope this helps!
 
Upvote 0
Hi
Welcome to the board

Please post your excel version.

Remark:
When you post it helps if you post the excel version that you are using so that we know what you have available.
For ex., in this case, if you are using the later versions of excel this would be an easy task.
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top