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

Johnny00

New Member
Joined
Oct 1, 2021
Messages
2
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: 19
  • Snip sheet 2.PNG
    Snip sheet 2.PNG
    128.2 KB · Views: 19

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Toadstool

Well-known Member
Joined
Mar 5, 2018
Messages
2,439
Office Version
  1. 2016
Platform
  1. Windows
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)
 

Alex Blakenburg

Well-known Member
Joined
Feb 23, 2021
Messages
2,640
Office Version
  1. 365
Platform
  1. Windows
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)
 

Johnny00

New Member
Joined
Oct 1, 2021
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Thank you Toadstool, the text option worked. I still couldn't get the rounding method to work, but text works for me.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,821
Messages
5,766,638
Members
425,364
Latest member
jstubs99

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
Top