Averageifs or some other way ?

JimM

Well-known Member
Joined
Nov 11, 2003
Messages
743
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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
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,565
Messages
6,125,583
Members
449,237
Latest member
Chase S

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