Average of income for the last 6 months (rolling) excluding weekends

Carlos5

Board Regular
Joined
Jan 14, 2015
Messages
58
Hello all, I did search but I can't find anything that helps me so here goes:
I am using Excel 2019. Column A has the date, Column B has the day (Mon, Tues, etc), and column C has the total $ made for that day. I am trying to write a formula to give me the average of the last 6 months excluding Sat and Sun. I assume I could use the Column B (the Day column) to exclude Sat and Sun. and use the TODAY() function -180 days to get the time frame but I can't seem to put the two togther.
Thanks for any help you can give me.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
If you have LET functions this can probably be done a little easier. but try this:
(you do not need a column for day of week, unless you want it in a separate column, this formula reads the weekday number from the date column)

Book1
ABCD
1DateEarningsLast 6 Months
2Sun 2023-01-0167 
3Mon 2023-01-02111111.00
4Tue 2023-01-0389100.00
5Wed 2023-01-049297.33
6Thu 2023-01-055586.75
7Fri 2023-01-069287.80
8Sat 2023-01-0710487.80
9Sun 2023-01-0812087.80
10Mon 2023-01-097285.17
11Tue 2023-01-106682.43
12Wed 2023-01-115378.75
13Thu 2023-01-1210381.44
14Fri 2023-01-137280.50
15Sat 2023-01-1411880.50
16Sun 2023-01-1511480.50
17Mon 2023-01-1612184.18
18Tue 2023-01-175181.42
19Wed 2023-01-1812584.77
20Thu 2023-01-198284.57
21Fri 2023-01-209785.40
22Sat 2023-01-2110885.40
23Sun 2023-01-2211485.40
24Mon 2023-01-2311587.25
25Tue 2023-01-247886.71
26Wed 2023-01-257786.17
27Thu 2023-01-269586.63
28Fri 2023-01-2710287.40
29Sat 2023-01-287287.40
30Sun 2023-01-2911487.40
31Mon 2023-01-3012289.05
32Tue 2023-01-315787.59
33Wed 2023-02-017787.13
34Thu 2023-02-0210587.88
35Fri 2023-02-038887.88
36Sat 2023-02-049587.88
37Sun 2023-02-057087.88
38Mon 2023-02-068987.92
39Tue 2023-02-079588.19
40Wed 2023-02-0811088.96
41Thu 2023-02-0911289.76
42Fri 2023-02-108789.67
43Sat 2023-02-117089.67
44Sun 2023-02-126389.67
45Mon 2023-02-1311690.52
46Tue 2023-02-147490.00
47Wed 2023-02-157489.52
48Thu 2023-02-1611090.12
49Fri 2023-02-176689.43
50Sat 2023-02-189389.43
51Sun 2023-02-197289.43
52Mon 2023-02-206088.61
53Tue 2023-02-218088.38
54Wed 2023-02-2210188.71
55Thu 2023-02-235887.92
56Fri 2023-02-247987.70
57Sat 2023-02-258487.70
58Sun 2023-02-265587.70
59Mon 2023-02-276487.12
60Tue 2023-02-2810387.50
61Wed 2023-03-0111388.09
62Thu 2023-03-0212288.86
63Fri 2023-03-036688.36
64Sat 2023-03-0411288.36
65Sun 2023-03-059388.36
66Mon 2023-03-0610888.78
67Tue 2023-03-079088.81
68Wed 2023-03-086288.25
69Thu 2023-03-095387.53
70Fri 2023-03-106287.02
71Sat 2023-03-118787.02
72Sun 2023-03-126387.02
73Mon 2023-03-135986.47
74Tue 2023-03-1410286.77
75Wed 2023-03-1511587.30
76Thu 2023-03-1610987.70
77Fri 2023-03-177787.51
78Sat 2023-03-188087.51
79Sun 2023-03-197987.51
80Mon 2023-03-206987.18
81Tue 2023-03-2112187.77
82Wed 2023-03-229187.83
83Thu 2023-03-235787.31
84Fri 2023-03-247587.10
85Sat 2023-03-2510087.10
86Sun 2023-03-2611787.10
87Mon 2023-03-2712587.72
88Tue 2023-03-2810187.94
89Wed 2023-03-298387.86
90Thu 2023-03-307187.59
91Fri 2023-03-317187.34
92Sat 2023-04-0112387.34
93Sun 2023-04-0211887.34
94Mon 2023-04-036086.92
95Tue 2023-04-046886.64
96Wed 2023-04-0510486.90
97Thu 2023-04-067286.68
98Fri 2023-04-077086.44
99Sat 2023-04-0810486.44
100Sun 2023-04-097686.44
101Mon 2023-04-107486.27
102Tue 2023-04-119786.42
103Wed 2023-04-125085.92
104Thu 2023-04-135285.46
105Fri 2023-04-145985.11
106Sat 2023-04-1510685.11
107Sun 2023-04-165785.11
108Mon 2023-04-175384.68
109Tue 2023-04-1811485.06
110Wed 2023-04-195784.71
111Thu 2023-04-2010284.92
112Fri 2023-04-216184.63
113Sat 2023-04-2210784.63
114Sun 2023-04-236684.63
115Mon 2023-04-249284.72
116Tue 2023-04-2510184.91
117Wed 2023-04-268784.94
118Thu 2023-04-275884.62
119Fri 2023-04-2812185.05
120Sat 2023-04-296785.05
121Sun 2023-04-308585.05
122Mon 2023-05-0112185.47
123Tue 2023-05-0212185.87
124Wed 2023-05-0310086.03
125Thu 2023-05-0411086.30
126Fri 2023-05-0511586.62
127Sat 2023-05-0610286.62
128Sun 2023-05-075386.62
129Mon 2023-05-085386.25
130Tue 2023-05-095585.91
131Wed 2023-05-1011286.19
132Thu 2023-05-1111886.53
133Fri 2023-05-129286.59
134Sat 2023-05-1310186.59
135Sun 2023-05-146186.59
136Mon 2023-05-158986.61
137Tue 2023-05-166686.40
138Wed 2023-05-177686.30
139Thu 2023-05-187786.20
140Fri 2023-05-197486.08
141Sat 2023-05-209786.08
142Sun 2023-05-2110586.08
143Mon 2023-05-2210986.31
144Tue 2023-05-237886.23
145Wed 2023-05-2411586.50
146Thu 2023-05-257086.35
147Fri 2023-05-266786.16
148Sat 2023-05-275586.16
149Sun 2023-05-287886.16
150Mon 2023-05-298786.17
151Tue 2023-05-3011086.39
152Wed 2023-05-3112386.73
153Thu 2023-06-017586.62
154Fri 2023-06-028386.59
155Sat 2023-06-039686.59
156Sun 2023-06-047786.59
157Mon 2023-06-0510986.79
158Tue 2023-06-0611287.02
159Wed 2023-06-077086.87
160Thu 2023-06-088386.83
161Fri 2023-06-0911787.10
162Sat 2023-06-1012487.10
163Sun 2023-06-116187.10
164Mon 2023-06-126386.89
165Tue 2023-06-1310787.06
166Wed 2023-06-146386.86
167Thu 2023-06-1511387.08
168Fri 2023-06-168387.04
169Sat 2023-06-179587.04
170Sun 2023-06-1810887.04
171Mon 2023-06-1912587.36
172Tue 2023-06-205887.11
173Wed 2023-06-2111387.33
174Thu 2023-06-227687.23
175Fri 2023-06-238987.25
176Sat 2023-06-245087.25
177Sun 2023-06-2510587.25
178Mon 2023-06-269187.28
179Tue 2023-06-275987.06
180Wed 2023-06-287786.98
181Thu 2023-06-296986.84
182Fri 2023-06-309986.93
183Sat 2023-07-018286.93
184Sun 2023-07-028786.93
185Mon 2023-07-0312587.04
186Tue 2023-07-0410687.17
187Wed 2023-07-0510887.29
188Thu 2023-07-067287.42
189Fri 2023-07-075987.17
190Sat 2023-07-0810787.17
191Sun 2023-07-098187.17
192Mon 2023-07-108487.26
193Tue 2023-07-119587.48
194Wed 2023-07-1211287.94
195Thu 2023-07-136587.65
196Fri 2023-07-149887.85
197Sat 2023-07-157387.85
198Sun 2023-07-1610087.85
199Mon 2023-07-1712387.86
200Tue 2023-07-1811688.36
Sheet1
Cell Formulas
RangeFormula
D2:D200D2=IFERROR(SUMPRODUCT(($A$2:A2>=EDATE($A2,-6))*($A$2:A2<=($A2))*($C$2:$C2)*(WEEKDAY($A$2:$A2,2)<6)) / SUMPRODUCT(($A$2:A2>=EDATE($A2,-6))*($A$2:A2<=($A2))*(WEEKDAY($A$2:$A2,2)<6)),"")
 
Upvote 0
If you have LET functions this can probably be done a little easier. but try this:
(you do not need a column for day of week, unless you want it in a separate column, this formula reads the weekday number from the date column)

Book1
ABCD
1DateEarningsLast 6 Months
2Sun 2023-01-0167 
3Mon 2023-01-02111111.00
4Tue 2023-01-0389100.00
5Wed 2023-01-049297.33
6Thu 2023-01-055586.75
7Fri 2023-01-069287.80
8Sat 2023-01-0710487.80
9Sun 2023-01-0812087.80
10Mon 2023-01-097285.17
11Tue 2023-01-106682.43
12Wed 2023-01-115378.75
13Thu 2023-01-1210381.44
14Fri 2023-01-137280.50
15Sat 2023-01-1411880.50
16Sun 2023-01-1511480.50
17Mon 2023-01-1612184.18
18Tue 2023-01-175181.42
19Wed 2023-01-1812584.77
20Thu 2023-01-198284.57
21Fri 2023-01-209785.40
22Sat 2023-01-2110885.40
23Sun 2023-01-2211485.40
24Mon 2023-01-2311587.25
25Tue 2023-01-247886.71
26Wed 2023-01-257786.17
27Thu 2023-01-269586.63
28Fri 2023-01-2710287.40
29Sat 2023-01-287287.40
30Sun 2023-01-2911487.40
31Mon 2023-01-3012289.05
32Tue 2023-01-315787.59
33Wed 2023-02-017787.13
34Thu 2023-02-0210587.88
35Fri 2023-02-038887.88
36Sat 2023-02-049587.88
37Sun 2023-02-057087.88
38Mon 2023-02-068987.92
39Tue 2023-02-079588.19
40Wed 2023-02-0811088.96
41Thu 2023-02-0911289.76
42Fri 2023-02-108789.67
43Sat 2023-02-117089.67
44Sun 2023-02-126389.67
45Mon 2023-02-1311690.52
46Tue 2023-02-147490.00
47Wed 2023-02-157489.52
48Thu 2023-02-1611090.12
49Fri 2023-02-176689.43
50Sat 2023-02-189389.43
51Sun 2023-02-197289.43
52Mon 2023-02-206088.61
53Tue 2023-02-218088.38
54Wed 2023-02-2210188.71
55Thu 2023-02-235887.92
56Fri 2023-02-247987.70
57Sat 2023-02-258487.70
58Sun 2023-02-265587.70
59Mon 2023-02-276487.12
60Tue 2023-02-2810387.50
61Wed 2023-03-0111388.09
62Thu 2023-03-0212288.86
63Fri 2023-03-036688.36
64Sat 2023-03-0411288.36
65Sun 2023-03-059388.36
66Mon 2023-03-0610888.78
67Tue 2023-03-079088.81
68Wed 2023-03-086288.25
69Thu 2023-03-095387.53
70Fri 2023-03-106287.02
71Sat 2023-03-118787.02
72Sun 2023-03-126387.02
73Mon 2023-03-135986.47
74Tue 2023-03-1410286.77
75Wed 2023-03-1511587.30
76Thu 2023-03-1610987.70
77Fri 2023-03-177787.51
78Sat 2023-03-188087.51
79Sun 2023-03-197987.51
80Mon 2023-03-206987.18
81Tue 2023-03-2112187.77
82Wed 2023-03-229187.83
83Thu 2023-03-235787.31
84Fri 2023-03-247587.10
85Sat 2023-03-2510087.10
86Sun 2023-03-2611787.10
87Mon 2023-03-2712587.72
88Tue 2023-03-2810187.94
89Wed 2023-03-298387.86
90Thu 2023-03-307187.59
91Fri 2023-03-317187.34
92Sat 2023-04-0112387.34
93Sun 2023-04-0211887.34
94Mon 2023-04-036086.92
95Tue 2023-04-046886.64
96Wed 2023-04-0510486.90
97Thu 2023-04-067286.68
98Fri 2023-04-077086.44
99Sat 2023-04-0810486.44
100Sun 2023-04-097686.44
101Mon 2023-04-107486.27
102Tue 2023-04-119786.42
103Wed 2023-04-125085.92
104Thu 2023-04-135285.46
105Fri 2023-04-145985.11
106Sat 2023-04-1510685.11
107Sun 2023-04-165785.11
108Mon 2023-04-175384.68
109Tue 2023-04-1811485.06
110Wed 2023-04-195784.71
111Thu 2023-04-2010284.92
112Fri 2023-04-216184.63
113Sat 2023-04-2210784.63
114Sun 2023-04-236684.63
115Mon 2023-04-249284.72
116Tue 2023-04-2510184.91
117Wed 2023-04-268784.94
118Thu 2023-04-275884.62
119Fri 2023-04-2812185.05
120Sat 2023-04-296785.05
121Sun 2023-04-308585.05
122Mon 2023-05-0112185.47
123Tue 2023-05-0212185.87
124Wed 2023-05-0310086.03
125Thu 2023-05-0411086.30
126Fri 2023-05-0511586.62
127Sat 2023-05-0610286.62
128Sun 2023-05-075386.62
129Mon 2023-05-085386.25
130Tue 2023-05-095585.91
131Wed 2023-05-1011286.19
132Thu 2023-05-1111886.53
133Fri 2023-05-129286.59
134Sat 2023-05-1310186.59
135Sun 2023-05-146186.59
136Mon 2023-05-158986.61
137Tue 2023-05-166686.40
138Wed 2023-05-177686.30
139Thu 2023-05-187786.20
140Fri 2023-05-197486.08
141Sat 2023-05-209786.08
142Sun 2023-05-2110586.08
143Mon 2023-05-2210986.31
144Tue 2023-05-237886.23
145Wed 2023-05-2411586.50
146Thu 2023-05-257086.35
147Fri 2023-05-266786.16
148Sat 2023-05-275586.16
149Sun 2023-05-287886.16
150Mon 2023-05-298786.17
151Tue 2023-05-3011086.39
152Wed 2023-05-3112386.73
153Thu 2023-06-017586.62
154Fri 2023-06-028386.59
155Sat 2023-06-039686.59
156Sun 2023-06-047786.59
157Mon 2023-06-0510986.79
158Tue 2023-06-0611287.02
159Wed 2023-06-077086.87
160Thu 2023-06-088386.83
161Fri 2023-06-0911787.10
162Sat 2023-06-1012487.10
163Sun 2023-06-116187.10
164Mon 2023-06-126386.89
165Tue 2023-06-1310787.06
166Wed 2023-06-146386.86
167Thu 2023-06-1511387.08
168Fri 2023-06-168387.04
169Sat 2023-06-179587.04
170Sun 2023-06-1810887.04
171Mon 2023-06-1912587.36
172Tue 2023-06-205887.11
173Wed 2023-06-2111387.33
174Thu 2023-06-227687.23
175Fri 2023-06-238987.25
176Sat 2023-06-245087.25
177Sun 2023-06-2510587.25
178Mon 2023-06-269187.28
179Tue 2023-06-275987.06
180Wed 2023-06-287786.98
181Thu 2023-06-296986.84
182Fri 2023-06-309986.93
183Sat 2023-07-018286.93
184Sun 2023-07-028786.93
185Mon 2023-07-0312587.04
186Tue 2023-07-0410687.17
187Wed 2023-07-0510887.29
188Thu 2023-07-067287.42
189Fri 2023-07-075987.17
190Sat 2023-07-0810787.17
191Sun 2023-07-098187.17
192Mon 2023-07-108487.26
193Tue 2023-07-119587.48
194Wed 2023-07-1211287.94
195Thu 2023-07-136587.65
196Fri 2023-07-149887.85
197Sat 2023-07-157387.85
198Sun 2023-07-1610087.85
199Mon 2023-07-1712387.86
200Tue 2023-07-1811688.36
Sheet1
Cell Formulas
RangeFormula
D2:D200D2=IFERROR(SUMPRODUCT(($A$2:A2>=EDATE($A2,-6))*($A$2:A2<=($A2))*($C$2:$C2)*(WEEKDAY($A$2:$A2,2)<6)) / SUMPRODUCT(($A$2:A2>=EDATE($A2,-6))*($A$2:A2<=($A2))*(WEEKDAY($A$2:$A2,2)<6)),"")
Don't know if this is what OP is asking for, but would using Average and Filter work to get the average?

Just saw that OP is using Excel 2019. Amended the previous answer.

PERSONAL.xlsm
ABCDE
11/1/20231359313.2333
21/2/20232303
31/3/20233227
41/4/20234470
51/5/20235478
61/6/20236321
71/7/20237258
81/8/20231344
91/9/20232228
101/10/20233147
111/11/20234493
121/12/20235365
131/13/20236101
141/14/20237480
151/15/20231436
161/16/2023285
171/17/20233379
181/18/20234365
191/19/20235233
201/20/20236381
211/21/20237275
221/22/20231384
231/23/20232139
241/24/20233178
251/25/20234304
261/26/20235456
271/27/20236421
281/28/20237284
291/29/20231299
301/30/20232378
311/31/20233347
322/1/20234404
332/2/20235106
342/3/20236157
352/4/20237128
362/5/20231336
372/6/20232179
382/7/20233313
392/8/20234253
402/9/20235409
412/10/20236184
Sheet4
Cell Formulas
RangeFormula
E1E1=AVERAGEIFS(C1:C41,B1:B41,"<"&6)
 
Upvote 0
Don't know if this is what OP is asking for, but would using Average and Filter work to get the average?

Just saw that OP is using Excel 2019. Amended the previous answer.

PERSONAL.xlsm
ABCDE
11/1/20231359313.2333
21/2/20232303
31/3/20233227
41/4/20234470
51/5/20235478
61/6/20236321
71/7/20237258
81/8/20231344
91/9/20232228
101/10/20233147
111/11/20234493
121/12/20235365
131/13/20236101
141/14/20237480
151/15/20231436
161/16/2023285
171/17/20233379
181/18/20234365
191/19/20235233
201/20/20236381
211/21/20237275
221/22/20231384
231/23/20232139
241/24/20233178
251/25/20234304
261/26/20235456
271/27/20236421
281/28/20237284
291/29/20231299
301/30/20232378
311/31/20233347
322/1/20234404
332/2/20235106
342/3/20236157
352/4/20237128
362/5/20231336
372/6/20232179
382/7/20233313
392/8/20234253
402/9/20235409
412/10/20236184
Sheet4
Cell Formulas
RangeFormula
E1E1=AVERAGEIFS(C1:C41,B1:B41,"<"&6)
Hi,
How would this exclude weekends?
Thanks
 
Upvote 0
Hi,
How would this exclude weekends?
Thanks
Oops. That formula did not exclude the weekends properly.

VBA Code:
AVERAGEIFS(C1:C41,B1:B41,"<"&7,B1:B41,">"&1)

This one does. Excel assigns 1 to Sunday and 7 to Saturday. This formula looks for the weekdays in column B which are greater than one and less than 6. I'm unsure if this includes the rolling average as you requested though.
 
Upvote 0
Hello again,
While it looks to me like this will work, I realize that it isn't what I was looking for. I'm sorry if I wasn't exact enough. Rather than a running total in a new column, I am looking for a single cell that gives me the average for the last 6 months excluding weekends. Does that make more sense?
Thanks
 
Upvote 0
Hello again,
While it looks to me like this will work, I realize that it isn't what I was looking for. I'm sorry if I wasn't exact enough. Rather than a running total in a new column, I am looking for a single cell that gives me the average for the last 6 months excluding weekends. Does that make more sense?
Thanks
In that case, then maybe this formula works afterall?

PERSONAL.xlsm
ABCDE
11/1/20231359293.4667
21/2/20232303
31/3/20233227
41/4/20234470
51/5/20235478
61/6/20236321
71/7/20237258
81/8/20231344
91/9/20232228
101/10/20233147
111/11/20234493
121/12/20235365
131/13/20236101
141/14/20237480
151/15/20231436
161/16/2023285
171/17/20233379
181/18/20234365
191/19/20235233
201/20/20236381
211/21/20237275
221/22/20231384
231/23/20232139
241/24/20233178
251/25/20234304
261/26/20235456
271/27/20236421
281/28/20237284
291/29/20231299
301/30/20232378
311/31/20233347
322/1/20234404
332/2/20235106
342/3/20236157
352/4/20237128
362/5/20231336
372/6/20232179
382/7/20233313
392/8/20234253
402/9/20235409
412/10/20236184
Sheet4
Cell Formulas
RangeFormula
E1E1=AVERAGEIFS(C1:C41,B1:B41,"<"&7,B1:B41,">"&1)
 
Upvote 0
Oops. That formula did not exclude the weekends properly.

VBA Code:
AVERAGEIFS(C1:C41,B1:B41,"<"&7,B1:B41,">"&1)

This one does. Excel assigns 1 to Sunday and 7 to Saturday. This formula looks for the weekdays in column B which are greater than one and less than 6. I'm unsure if this includes the rolling average as you requested though.
Thanks, It gives me something to work with.
 
Upvote 0
Thanks, It gives me something to work with. I am trying to avoid VBA but if I must :)
Formula above should work for what you need(Post # 8). It however will not automatically filter for the last 6 months. Another alternative would be to use a pivot table? You can create a pivot table and filter out the days you don't want. Then you can summarize the values as an average to get your numbers.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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