Adjust OFFSET length for holidays

silviosilver

New Member
Joined
Aug 12, 2015
Messages
24
In this sheet, column H finds the weekly MAX from 01/02/1993 based on the OFFSET values given in columns F and G.

The formula in column H is =MAX(OFFSET($B$3,F2,0,1,1):OFFSET($B$3,G2,0,1,1))

The value in H2 is the MAX from 01/02/1993 to 05/02/1993 (calculated from data not shown below)
The value in H3 is the MAX from 08/02/1993 to 12/02/1993

and so on.

However, the data I have omits weekends and holidays, therefore some 5-day "weeks" have less than five days in them.

In the example below, 16/02/1993 is a Tuesday, not a Monday as my formula was expecting, therefore this particular 5-day week ends on the 22/02/1993, not 19/02/1993 as I would like it to.

These missing days are throwing off my results.

Is there some way I could dynamically update my OFFSET periods to adjust for weeks with less than five days in them?

EFGH

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"]1/02/1993[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]$45,843.70[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]2/02/1993[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]$45,500.00[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]3/02/1993[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]$45,250.00[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"]4/02/1993[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]19[/TD]
[TD="align: right"]$45,812.50[/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]5/02/1993[/TD]
[TD="align: right"]20[/TD]
[TD="align: right"]24[/TD]
[TD="align: right"]$45,281.20[/TD]

[TD="align: center"]7[/TD]
[TD="align: right"]8/02/1993[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]29[/TD]
[TD="align: right"]$46,593.70[/TD]

[TD="align: center"]8[/TD]
[TD="align: right"]9/02/1993[/TD]
[TD="align: right"]30[/TD]
[TD="align: right"]34[/TD]
[TD="align: right"]$46,562.50[/TD]

[TD="align: center"]9[/TD]
[TD="align: right"]10/02/1993[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]39[/TD]
[TD="align: right"]$47,156.20[/TD]

[TD="align: center"]10[/TD]
[TD="align: right"]11/02/1993[/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]44[/TD]
[TD="align: right"]$46,937.50[/TD]

[TD="align: center"]11[/TD]
[TD="align: right"]12/02/1993[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]49[/TD]
[TD="align: right"]$47,593.70[/TD]

[TD="align: center"]12[/TD]
[TD="align: right"]16/02/1993[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]54[/TD]
[TD="align: right"]$48,312.50[/TD]

[TD="align: center"]13[/TD]
[TD="align: right"]17/02/1993[/TD]
[TD="align: right"]55[/TD]
[TD="align: right"]59[/TD]
[TD="align: right"]$47,312.50[/TD]

[TD="align: center"]14[/TD]
[TD="align: right"]18/02/1993[/TD]
[TD="align: right"]60[/TD]
[TD="align: right"]64[/TD]
[TD="align: right"]$45,718.70[/TD]

[TD="align: center"]15[/TD]
[TD="align: right"]19/02/1993[/TD]
[TD="align: right"]65[/TD]
[TD="align: right"]69[/TD]
[TD="align: right"]$46,468.70[/TD]

[TD="align: center"]16[/TD]
[TD="align: right"]22/02/1993[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"]74[/TD]
[TD="align: right"]$46,562.50[/TD]

</tbody>
Sheet1
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Depending on your version of Excel:

E4:=MAXIFS(B$2:B$18,A$2:A$18,"<="& D4,A$2:A$18,">="&D4-4)

OR

E4: {=MAX(IF((A$2:A$18<=D4)*(A$2:A$18>=D4-4),B$2:B$18))} array-entered


Excel 2010
ABCDE
1DateValueMaximum for
2Mon 13 Nov 20179week ending
3Tue 14 Nov 201714
4Wed 15 Nov 20173Fri 17 Nov 201714
5Thu 16 Nov 20174Fri 24 Nov 201719
6Fri 17 Nov 20174Fri 1 Dec 201713
7Tue 21 Nov 20178Fri 8 Dec 201720
8Wed 22 Nov 201719
9Thu 23 Nov 20175
10Mon 27 Nov 201713
11Tue 28 Nov 20178
12Wed 29 Nov 201712
13Thu 30 Nov 201712
14Mon 4 Dec 20179
15Tue 5 Dec 201720
16Wed 6 Dec 201712
17Thu 7 Dec 20175
18Fri 8 Dec 20173
Sheet1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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