Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel: Average date difference of a range

Posted on 2016-08-03
10
Medium Priority
?
106 Views
Last Modified: 2016-08-04
Hello,

Seeking help on calculating the average date difference of a range. I thought the best approach would be to use a sumifs, followed by an average however sumifs does't total the numeric date.

See the attached spreadsheet. How would I find the average date difference for dates within a given range?
ee-average-dates.xlsx
0
Comment
Question by:dabug80
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 52

Expert Comment

by:Rgonzo1971
ID: 41741840
Hi,

pls try
=IFERROR(AVERAGEIFS($C$3:$C$9,$C$3:$C$9,">="&B$13,$C$3:$C$9,"<"&B$13+7)-AVERAGEIFS($B$3:$B$9,$C$3:$C$9,">="&B$13,$C$3:$C$9,"<"&B$13+7),"-")

Open in new window

Regards
ee-average-datesV1.xlsx
0
 
LVL 1

Author Comment

by:dabug80
ID: 41741853
Thanks Rgonzo.

I have never heard of Averageifs.

I wish to change the column references to full columns (e.g C:C), doing this doesn't work with averages, so I will need to define the active cell range. Is there an easy way to do this with a growing number of rows?
0
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 total points
ID: 41741862
pls try

=IFERROR(AVERAGEIFS($C:$C;$C:$C;">="&K$13;$C:$C;"<"&K$13+7)-AVERAGEIFS($B:$B;$C:$C;">="&K$13;$C:$C;"<"&K$13+7);"-")

Open in new window

ee-average-datesV2.xlsx
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Expert Comment

by:xtermie
ID: 41741903
Try the formula in the attached file.  Similar to Rgonzo's but take into account that column C had your data.  Rearranged the data a bit and assumed you wanted to fill in the formula across your dates for each pair of dates (week)
ee-average-dates_wexample.xlsx
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41742588
Alternative, add a duration column to the list with simple formula "Delivery Date" less "Approved Date". You can then do the Averageifs formula on this column.

Assuming Duration in column D, formula in B14 and then copied across:

=IFERROR(AVERAGEIFS($D3:$D9,$C3:$C9,">="&B13,$C3:$C9,"<"&B13+7),0)

You could adjust the duration to only include working days if so required.
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41742593
To overcome the expanding range, convert the list to a table; then the above formula will become:

=IFERROR(AVERAGEIFS(Table1[Duration],Table1[Delivered],">="&B13,Table1[Delivered],"<"&B13+7),0)

Thanks
Rob H
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41742631
Now that is bizarre, I was going to comment on RGOnzo's formula being mathematically incorrect but it does actually give the same results as I get with the formula I posted.

Syntax of mine is  AVERAGE(Date 1 - Date 2) ie Average duration

whereas yours are looking at (Sum of Date Range1/Count of DateRange1)  - (Sum of Date Range2/Count of DateRange2);  (ie Average Date1 - Average Date2)

I was always of the opinion that Averages and Products had to be done at the source level to ensure that the placement of the operators ( * or /) were in the right place but it seems to not matter in this case.
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 41742675
Just looked at the file uploaded by xtermie and I see they have done the same as me, calculated duration and then done the average of that. Apologies to xtermie if it seemed I was copying. No points to me for that part, maybe just for the Table suggestion.

Slight difference with my suggestion is that I have used the IFERROR function.

The syntax for that being: IFERROR(Formula,False)

Whereas xtermie has used combination of IF and ISERROR

The syntax for that being IF(ISERROR(Formula),False,Formula)
0
 
LVL 18

Expert Comment

by:xtermie
ID: 41742700
Hey Rob, no need to apologize, we are probably just thinking alike :)
Hopefully dabug80 will find our suggestions/solutions helpful and will resolve their issue.
0
 
LVL 1

Author Closing Comment

by:dabug80
ID: 41743476
This is an excellent solution. It's perfect as it doesn't use an additional helper column (which I can't add due to a CSV dump). Thanks for your great help.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question