Averaging dates within each month.

Rachelpan

New Member
Joined
Jan 29, 2020
Messages
24
Office Version
  1. 2010
Platform
  1. Windows
Column A has 12 months January through December.
Each month has several dates of deliveries.
I need a formula that will provide me with the average delivery date for each month and put the result in column B.

For example - column A goes from 2 to 200. All data is listed in date form (i.e. 1/12/2018) - January has 10 different delivery dates and 3 that are the same.
I would like all dates listed in January to be averaged and the result in column B (e.g. column heading "average by month" 1/13/2018 in B2; 2/4/2018 in B3, etc.).
Hope this makes sense.
Regards
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Racelpan,

You could add a column with month and year (just in case you ever have more than one year in the list) and then AVERAGEIFS the date for rows where it's the same month. As you can see my January 2019 average is 3am on the 17th.

Cell Formulas
RangeFormula
B2:B18B2=MONTH(A2)&"-"&YEAR(A2)
C2:C18C2=AVERAGEIFS($A$2:$A$200,$B$2:$B$200,B2)
 
Upvote 0
Back for a quick question.
When I may be looking at 3 or more years of data - column C would be rather lengthy.
Is it possible to have column C reference the average date in each month only once, rather than repeatedly?
Thank you
Regards
 
Upvote 0
Let me give you two ways of doing this. For both ways I've changed the range to go down to row 9,999 so you may want to make a cup of coffee while it runs.

Option 1: Just check if the previous Month/Year matches this one and if so display null:

Book1
ABC
1Delivery DatesMYAverage
21/1/20191-20191/17/2019 3:00:00 AM
31/8/20191-2019 
41/9/20191-2019 
51/15/20191-2019 
61/22/20191-2019 
71/22/20191-2019 
81/29/20191-2019 
91/31/20191-2019 
102/6/20192-20192/13/2019 3:25:43 AM
112/9/20192-2019 
122/9/20192-2019 
Sheet1 (2)
Cell Formulas
RangeFormula
B2:B12B2=MONTH(A2)&"-"&YEAR(A2)
C2:C12C2=IF(B2=B1,"",AVERAGEIFS($A$2:$A$9999,$B$2:$B$9999,B2))


Option 2: Build a list of unique Month/Years (could be on another tab) and then do the AVERAGEIFS:

Cell Formulas
RangeFormula
F2:F13F2=INDEX($B$2:$B$9999,MATCH(0,INDEX(COUNTIF($F$1:$F1,$B$2:$B$9999),),0))&""
G2:G13G2=IF(F2="","",AVERAGEIFS($A$2:$A$9999,$B$2:$B$9999,F2))
 
Upvote 0
Both options look great.
I will try both.
Again, your quick response is greatly appreciated.
Regards
R.
 
Upvote 0

Forum statistics

Threads
1,214,553
Messages
6,120,182
Members
448,948
Latest member
spamiki

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