+ Reply to Thread
Results 1 to 3 of 3

Average of Days from Date Range

  1. #1
    Registered User
    Join Date
    05-29-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Average of Days from Date Range

    I currently have the following formula to calculate average of days within a specific date range in excel. The question I have is will this formula give the correct average? Right now, it pulls data from a different sheet from column C and D within the date range defined on the worksheet where the average will be displayed. Column G specifies the days in the same worksheet as the dates. I gives me an average but, is this formula correct in giving an accurate average of days? Or will I need to only specify the date range in col C because the days are defined in col G for the average. Any help is appreciated, thanks.

    =AVERAGE(IF('SHEET NAME'!$C:$D>=A16,IF('SHEET NAME'!$C:$D<=C16,'SHEET NAME'!$G:$G)))

    Where A16 is the startdate and C16 is the enddate specified on the worksheet where the average will be.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Average of Days from Date Range

    If there is a match in both C and D for either condition, the value in G will be included twice for each match...

    try instead:

    =AVERAGE(IF(('SHEET NAME'!$C:$C>=A16)+('SHEET NAME'!$D:$D>=A16),IF(('SHEET NAME'!$C:$C<=C16)+('SHEET NAME'!$D:$D<=C16),'SHEET NAME'!$G:$G)))

    it is also recommended that you don't use whole column references with array formulas due to lack of efficiency.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-29-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Average of Days from Date Range

    Quote Originally Posted by NBVC View Post
    If there is a match in both C and D for either condition, the value in G will be included twice for each match...

    try instead:

    =AVERAGE(IF(('SHEET NAME'!$C:$C>=A16)+('SHEET NAME'!$D:$D>=A16),IF(('SHEET NAME'!$C:$C<=C16)+('SHEET NAME'!$D:$D<=C16),'SHEET NAME'!$G:$G)))

    it is also recommended that you don't use whole column references with array formulas due to lack of efficiency.
    Thank you very much it worked!! Also thanks for the heads up, I will try and define the range instead of the whole column.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1