Solved

Find an average on another sheet

Posted on 2013-06-21
6
443 Views
Last Modified: 2013-06-22
Hi guys,

I need to populate a sheet on Excel with averages in 24 hours blocks. I have a sheet with raw data every 30 minutes and another "averages" sheet where I write the "FROM" and "TO" dates (usually 24 hours range) and then the averages for all columns in the other sheet (48 cells in each average as the data is grabbed every 30 minutes).

Example Data Sheet:
06/01/2013 06:00 AM      5      10
06/01/2013 06:30 AM      4      12
06/01/2013 07:00 AM      3      11
06/01/2013 07:30 AM      5      09
................

Example Averages Sheet:
From 06/01/2013 06:00 AM To 06/02/2013 06:00 AM      4.5      11.5
................


Why does AVERAGE with two VLOOKUPs doesn't work? It works if I write a comma separating the two numbers and make an average between them but not if I use ":" to average a series of data between those two VLOOKUPs. Any ideas?

Thanks in advance!
0
Comment
Question by:Caracena
  • 3
  • 3
6 Comments
 
LVL 14

Expert Comment

by:Faustulus
ID: 39267650
VLOOKUP returns a value, not a range. The colon is used to define a starting and ending cell of a range. Since VLOOKUP doesn't return that kind of result (cells or ranges) it also can't work with the colon. However, you can enumerate values in the AVERAGE function, separating them by commas. That is why two values - in this case each returned by a VLOOKUP function - can be averaged if separated by commas.
In order to set a dynamic range from which to extract an average you may like to consider using INDEX to define the range and MATCH to specify rows depending upon their content.
0
 
LVL 6

Author Comment

by:Caracena
ID: 39267653
Thanks Faustulus. The problem is that I need to average all numbers between two given dates and all of that is in another sheet. Can it be done automatically?
0
 
LVL 14

Expert Comment

by:Faustulus
ID: 39267655
Can you post some data for me to test on?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Author Comment

by:Caracena
ID: 39267674
I've created a new book with a simple sample. In the second sheet you can see I have the real average but it's written by me. I need it to calculate it on itself from the first sheet as I enter the dates.

Thanks again!!!
Book1.xlsx
0
 
LVL 14

Accepted Solution

by:
Faustulus earned 500 total points
ID: 39267731
Please try this formula in your cell Averages!D1
=IFERROR(AVERAGE(INDIRECT(ADDRESS(MATCH($A$1,'RAW DATA'!$A:$A,1),2,1,1,"Raw Data")&":"&ADDRESS(MATCH($B$1,'RAW DATA'!$A:$A,1),2))),"")

Open in new window

Observe that the two MATCH functions both look for the same of nearest smaller value as indicated by the final 1 in MATCH($A$1,'RAW DATA'!$A:$A,1). If you change the 1 into 0 an exact match would be required. If such a match wouldn't be found an error yould result and no average would be returned.
Note that your formula in C1 could be simplified into =IF(AND(A1,B1),(B1-A1)*24,"")
0
 
LVL 6

Author Closing Comment

by:Caracena
ID: 39267861
Great answer! I couldn't find this ever! Thanks...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now