vlookup only returns last row or NA (I tried suggestions from other threads)

Johnny00

New Member
Joined
Oct 1, 2021
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
I am trying to lookup a date/time from sheet 1 and return the corresponding high value from sheet 2. I have tried rounding the date/time, didn't work. Tried changing formats for columns, didn't work. No idea what I'm missing, but I'm a novice so it's likely that I'm missing everything important. Here's what I have been trying:

=VLOOKUP(B2,Sheet2!B2:E285120,3,FALSE)
and
=VLOOKUP(ROUND(B2,5),Sheet2!B2:E285120,3,FALSE)
both return #N/A

If I remove the range_lookup it returns the appropriate column but only from the last row in the array
ex. =VLOOKUP(B2,Sheet2!B2:E285120,3)

I have been trying to figure this out for many hours, please help
 

Attachments

  • Snip sheet 1.PNG
    Snip sheet 1.PNG
    96.4 KB · Views: 59
  • Snip sheet 2.PNG
    Snip sheet 2.PNG
    128.2 KB · Views: 59

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi Johnny00,

Yes, it looks like a rounding challenge so you could insert a new column C on Sheet2 and make it =ROUND(B2,5) and copy down. Then on Sheet1 try the =VLOOKUP(ROUND(B2,5),Sheet2!B2:E285120,3,FALSE)

Another method would be to insert column C on Sheet2 and change the date and time to text with =TEXT(B2,"mm/dd/yyyy hh:mm")
Then on Sheet1 make the lookup =VLOOKUP(TEXT(B2,"mm/dd/yyyy hh:mm"),Sheet2!B2:E285120,3,FALSE)
 
Upvote 0
I agree with Toadstool that a helper column on Sheet 2 with rounding would be useful.

You can try this:-
which looks for a date/time that falls within a range of a few seconds.
Excel Formula:
=LOOKUP(2,1/
             ((Sheet2!$B$2:$E$285120>=ROUNDDOWN($B2,5))*
               (Sheet2!$B$2:$E$285120<=ROUNDUP($B2,5))),
     Sheet2!D$2:D$285120)
 
Upvote 0
Thank you Toadstool, the text option worked. I still couldn't get the rounding method to work, but text works for me.
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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