vlookup with time range

pencil_pusher

New Member
Joined
Apr 19, 2009
Messages
6
I want to know if the time in sheet1 A2 matches any time (plus or minus 12 hours) in sheet2 A2:B546, if so, then return the value for sheet2 A2. I'm getting hung up on the "plus or minus 12 hours". Can I use vlookup for this or will it not work because the range does not consist of single values?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Do the times run from zero upwards (eg race times) or are they times of the day, in which case how do you know if 6pm is from the previous day or the current day for comparison? Also how are the times formatted?
 
Upvote 0
Okay, I have two formulas.

=IF(ABS($A$2-Sheet2!A2)<=0.5,Sheet2!C2,"")

=VLOOKUP(A2,Sheet2!$A$2:$C$546,3,FALSE)

How do I combine them to get the desired result? Basically I want to know if each event in sheet 1 column A occurred within 12 hours of any event in Sheet 2 column A, if so then I want the corresponding value in sheet 2 column C (I said column A in my original post).
 
Upvote 0
Try this formula in B2 copied down

=INDEX(Sheet2!C$2:C$546,MATCH(TRUE,INDEX(ABS(A2-Sheet2!A$2:A$546)<=0.5,0),0))
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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