# Formula for average duration for each month based on the ending month

1. ## Formula for average duration for each month based on the ending month

Hello Everyone,

The help provided so far has been much appreciated.

Now I need to add a feature.
Here's the file.
monthly avg of duration.xlsx

The data consists of a START date and END date.
Column C is END date minus START date, or, the DURATION of the event (in days).

I need to list the average duration for each month based on the ending month.
For example -
For Jan, only one event ended and it took 8 days so the average would be 8 days.
For Feb and Mar however, no events ended so the avg would be 0.
To continue for clarity,
3 events ended in April...  Register To Reply

2. ## Re: Formula for average duration for each month based on the ending month

idk if this forum allows bumping of posts so I apologize in advance.

Can anyone help me out with this one?
I am at a total loss of how to get this done.

I did find  Register To Reply

3. ## Re: Formula for average duration for each month based on the ending month

See the attached file.

I used month() and year() formula.

After that i made an pivot table of it.  Register To Reply

4. ## Re: Formula for average duration for each month based on the ending month

I'm not familiar with pivot tables and was hoping to avoid that.

Ideally, I could use a formula similar to the one in columns F and G of the original sheet

or
A formula to sum the duration by month and from that I could simply divide by the result in Column G.  Register To Reply

5. ## Re: Formula for average duration for each month based on the ending month

@bobby769

If you gonna work, a lot, with excel I advice you to take a moment to learn the possibilities of Pivot Table.

MS Excel expands the possibilities on each new version.

It's an very, very, usefull and powerfull tool for such kind of work.

I will take a look at you file again, an will come back with an formula solution.

But:

Do youself a favour and learn pivot table.

Not long from now, you will be glad you have the tip to use it (if you found out all the solutions Pivot Table can give you).  Register To Reply

6. ## Re: Formula for average duration for each month based on the ending month

See the attached file (with sumproduct)  Register To Reply

7. ## Re: Formula for average duration for each month based on the ending month

Try this...

Enter this array formula** in H2 and copy down to H13:

=IF(G2>0,AVERAGE(IF(TEXT(End,"mmm")=E2,Duration)),0)

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

You may want to use rounding on these results as a couple of them are:

41.6666666666667
59.3333333333333

How many decimal places would you want to round to?  Register To Reply

8. ## Re: Formula for average duration for each month based on the ending month  Register To Reply