Advanced Lookup Formula Help

zcheezy

New Member
Joined
Aug 15, 2015
Messages
16
Hi all, I've used the site for help in the past, but this is my first post. I couldn't find a similar scenario and would appreciate any help here.

I am having trouble determining which formulas I need to use to get the values I want.


On my first sheet I have events and when they occurred by hour and date. The headers are date,event name,1,2,3,4,etc. Values are displayed if the event occurred during the intersecting date/hour.

On my second sheet I have the values I want to pull by date and hour. The headers are date(matches the values from sheet 1) and hour.

I want to put a formula in the last column on sheet 1 that will obtain the average of the values on sheet 2 for the date/hours the event occurred (i.e. only the hours that have a value in that row on sheet 1).

Ex:
Sheet 1:

dateevent12345679101112131415161718192021222324Lookup formula to obtain average of values on sheet 2 for hours that event occured
8/19/2011xyz50555160(=average of value on sheet 2 for hours 9-12 on 8/19/2011)
8/19/2011abc15100102(=average of value on sheet 2 for hours 4-6 on 8/19/2011)
8/20/2011xyz154623(=average of value on sheet 2 for hours 15-17 on 8/20/2011)

<tbody>
</tbody>

Sheet 2:
datehourvalue
8/19/201115
8/19/201126
8/19/201137

<tbody>
</tbody>
Continues for many more rows (hour1-24 for every day)

I have somewhat limited [FONT=inherit !important][FONT=inherit !important]Excel[/FONT][/FONT] experience. I don't know much about array formulas, so I wasn't sure if that was what I needed here. I would greatly appreciate any help.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
If this proves to be too difficult, I also have the same data from sheet 1 in a different format that doesn't include a value for each hour. The headers are: date, start hour, end hour, event name. So in this case, we wouldn't need to reference an hour based on if the cell contains a number, we would simply need to average the values on that date and in between(inclusive) the start and end hours. I would prefer the first format because I want to use the values in my analysis.

Anyways...
Other formatted Sheet 1:
datestartenddurationeventformula to pull average of values in sheet 2 that occur on the date in column A between start and end time
8/19/201115195xyz=average value from sheet 2 between hour 15 and 19(inclusive) on 8/19/2011
8/19/201152016abc=average value from sheet 2 between hour 5 and 20(inclusive) on 8/19/2011

<tbody>
</tbody>

Thanks again!
 
Upvote 0
I'm still working on a solution, so if anyone has any input it would be greatly appreciated!
 
Upvote 0
Hi,

have you tried using the =averageifs function?

for example =AVERAGEIFS(Sheet2!C:C,Sheet2!A:A,Sheet1!A1,Sheet2!B:B," >= "&Sheet1!B:B,Sheet2!B:B," <= "&Sheet1!C:C)

I used the data from your second post as it seemed a bit clearer.

Rick
 
Upvote 0

Forum statistics

Threads
1,216,885
Messages
6,133,283
Members
449,794
Latest member
THASNI

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