Averageifs or some other way ?

JimM

Well-known Member
Joined
Nov 11, 2003
Messages
741
Hi

I need a formula to average some data based on a date range but excluding weekends, a simplified data set would be

DateCount
16/01/2021​
1​
17/01/2021​
2​
18/01/2021​
3​
19/01/2021​
4​
20/01/2021​
5​
21/01/2021​
6​
22/01/2021​
7​
23/01/2021​
8​
24/01/2021​
9​
25/01/2021​
10​
26/01/2021​
11​


What I want is the average of the count column between the dates 18/01/21 and 25/01/21 but excluding the 23rd and 24th - the date range (ie 18th - 25th) is defined by input into cells F2 & F3 so the formula needs to cover the whole range

I've tried AVERAGEIFS which works for the date range

=AVERAGEIFS(B2:B12,A2:A12,">="&F2,A2:A12,"<="&F3)

but when I tried to exclude dates by incorporating a WEEKDAY element it fails

Any suggestion on how I achieve my goal would be much appreciated
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Excel Formula:
=SUMPRODUCT((--(WEEKDAY(A2:A12,2)<6))*(A2:A12>=F2)*(A2:A12<=F3)*(B2:B12))/SUMPRODUCT(--(WEEKDAY(A2:A12,2)<6)*(A2:A12>=F2)*(A2:A12<=F3))
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,320
Members
449,218
Latest member
Excel Master

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