Averaging data over three years based on date of a weekday or weekend

nmusoke17

New Member
Joined
Jun 5, 2024
Messages
6
Office Version
  1. 2019
Platform
  1. Windows
I have data based on date and day over three years. however, I want to do an average of the data for a particular date over the three years and if that date is a weekday for all three years it averages for all the years and if not, it only averages for the number of times that date falls on a weekday for those previous three years. What excel formula can I use to do that automatically?
 
Here are the same formulas i used in POST#5 using your new data (plus 20 more rows, since you did not include any different years). I also purposefully left the first column as numeric values of the dates (the first date is 2020/7/1). I aslo am showing the decimals in the second column.

PLEASE paste this exactly into a new worksheet or workbook. After you paste you may need to re-enter the formula (press F2 and then CSE or Enter).
(if you have to change commas to semi colons, please do so carefully). Also, you may not need to use CSE to commit the array formula for excel 2019, but if you get an error please try that.

Book1
ABCDEFGH
24FILTERCSE
2544013282,691.002020-Jul-01162,534.67162,534.67
2644014276,428.002020-Jul-02192,917.50192,917.50
2744015482,806.002020-Jul-03482,806.00482,806.00
2844016531,723.002020-Jul-04109,721.00109,721.00
2944017780,749.002020-Jul-05104,475.00104,475.00
3044018395,985.002020-Jul-06202,139.00202,139.00
3144019232,047.002020-Jul-07144,890.33144,890.33
3244020948,012.002020-Jul-08386,411.33386,411.33
3344021384,201.002020-Jul-09245,452.00245,452.00
3444022527,073.002020-Jul-10527,073.00527,073.00
3544378101,056.00
3644379109,407.00
3744380101,667.00
3844381105,914.00
3944382102,409.00
4044383104,376.00
4144384100,496.00
4244385101,644.00
4344386106,703.00
4444387109,928.00
4544743103,857.00
4644744106,815.00
4744745104,247.00
4844746109,721.00
4944747106,541.00
5044748106,056.00
5144749102,128.00
5244750109,578.00
5344751103,820.00
5444752106,012.00
Sheet1
Cell Formulas
RangeFormula
F25:F34F25=AVERAGE(FILTER($B$25:$B$54,(MONTH(E25)=MONTH($A$25:$A$54))*(DAY(E25)=DAY($A$25:$A$54))*(WEEKDAY($A$25:$A$54,2)<6)))
H25:H34H25=SUM((MONTH(E25)=MONTH(A25:A54))*(DAY(E25)=DAY(A25:A54))*(WEEKDAY(A25:A54,2)<6)*(B25:B54))/ SUM((MONTH(E25)=MONTH(A25:A54))*(DAY(E25)=DAY(A25:A54))*(WEEKDAY(A25:A54,2)<6))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,889
Messages
6,175,223
Members
452,620
Latest member
dsubash

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