Count weekends in a row

joslaz

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


I have a table with this format:

[TABLE="width: 500"]
<tbody>[TR]
[TD]ID[/TD]
[TD]Date[/TD]
[TD]Day[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]31.12.2017[/TD]
[TD]So[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]01.01.2018[/TD]
[TD]Mo[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]06.01.2018[/TD]
[TD]Sa[/TD]
[TD]9[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]13.01.2018[/TD]
[TD]Sa[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]14.01.2018[/TD]
[TD]So[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]15.01.2018[/TD]
[TD]Mo[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]01.01.2018[/TD]
[TD]Mo[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]


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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

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