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
21/02/199304$45,843.70
32/02/199359$45,500.00
43/02/19931014$45,250.00
54/02/19931519$45,812.50
65/02/19932024$45,281.20
78/02/19932529$46,593.70
89/02/19933034$46,562.50
910/02/19933539$47,156.20
1011/02/19934044$46,937.50
1112/02/19934549$47,593.70
1216/02/19935054$48,312.50
1317/02/19935559$47,312.50
1418/02/19936064$45,718.70
1519/02/19936569$46,468.70
1622/02/19937074$46,562.50

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

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