Count weekends in a row

joslaz

Board Regular
Joined
May 24, 2018
Messages
76
Hey guys!


I have a table with this format:

IDDateDayValue
131.12.2017So7
101.01.2018Mo8
106.01.2018Sa9
113.01.2018Sa8
114.01.2018So8
115.01.2018Mo7
201.01.2018Mo4

<tbody>
</tbody>


Now I have this aim:

I have a table that lists all IDs.
Now I want to know, if somebody have any entrys 3 weekends in a row.
So, the guy above have worked 3 weekends in a row.

How can I get this informationen?
Especially, if there is a year change.


Does anyone have any idea?


Best regards
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
The ID has worked 3 weekends in a row, so it should be true.
Or what do you asking for exactly?
 
Upvote 0
Many thanks!

Is your approach also without a matrix-function possible?

Owing to a large number of rows (750k) it is very slowly...
 
Upvote 0
Many thanks!

Is your approach also without a matrix-function possible?

Owing to a large number of rows (750k) it is very slowly...

What follow will still be slow with very large number of rows...


Book1
ABCDE
1IDDate
2131.12.20171Sun1TRUE
311.01.20181Mon2FALSE
416.01.20181Sat
5113.01.20181Sat
6114.01.20181Sun
7115.01.20181Mon
821.01.20182Mon
Sheet1 (2)


In C2 enter and copy down:

=A2&TEXT(B2,"ddd")

[1] Either...

In E2 control+shift+enter, not just enter, and copy down:

=MAX(FREQUENCY(IF(ISNUMBER(MATCH(C2:C8,D2&{"Sat","Sun"},0)),ROW(C2:C8)),IF(1-ISNUMBER(MATCH(C2:C8,D2&{"Sat","Sun"},0)),ROW(C2:C8))))>=3

[2] Or...

=MAX(FREQUENCY(IF(V(ISNUMBER(MATCH(C2:C8,D2&{"Sat","Sun"},0))),ROW(C2:C8)),IF(1-V(),ROW(C2:C8))))>=3

For the latter formula to work, we need to install the V() function using Alt+F11 of which the code is as follows:

Public Function V(Optional vrnt As Variant) As Variant
'
' Stephen Dunn
' 2002-09-12
'
Static vrntV As Variant
If Not IsMissing(vrnt) Then vrntV = vrnt
V = vrntV
End Function
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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