Return value of average weekdays based on month criteria

spurs50

New Member
Joined
Aug 6, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have dates for last 2 years in column A including weekends. I want to average all of May-2022 weekdays only for values in column B. I input May-2022 as date format in C3 to return avg of May.
I then want to have all months showing with links like in C3. I have the following two formulas which get very close but don't quite work.

=AVERAGE(IF(WEEKDAY(Sheet1!A2:A500,2)={1,2,3,4,5},Sheet1!B2:B500))
=AVERAGEIFS(Sheet1!B2:B500,Sheet1!A2:A500,">="&Sheet1!C3,Sheet1!A2:A500,"<="&EOMONTH(Sheet1!IC3,0))

Any idea to get it to work?
Thanks
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
How about
Excel Formula:
=AVERAGE(FILTER(B2:B500,(WEEKDAY(A2:A500,2)<6)*(A2:A500>=C3)*(A2:A500<=EOMONTH(C3,0))))
 
Upvote 0
Here is another idea:
MrExcel_20220728.xlsx
ABCD
1DateValues
24/16/202220Query Mo-YrAvg Wkdays
34/19/202223May-2219.57143
44/22/202218
54/25/202214
64/28/202229
75/1/202216
85/4/202212
95/7/202228
105/10/202225
115/13/202213
125/16/202222
135/19/202225
145/22/202210
155/25/202226
165/28/202210
175/31/202214
186/3/202225
196/6/202224
206/9/202228
216/12/202219
226/15/202226
236/18/202212
Sheet2
Cell Formulas
RangeFormula
D3D3=AVERAGE(IF((WEEKDAY(A2:A23,2)<6)*(EOMONTH(+A2:A23,0)=EOMONTH(C3,0)),B2:B23,""))
 
Upvote 0
That works! Thanks so much for your prompt replies. Would have taken me days to figure that out!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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