VLOOKUP Error - Value Sought Is Before First Range

dcunningham

Board Regular
Joined
Jul 14, 2015
Messages
58
Hello Everyone,

I've encountered an error while using the VLOOKUP function. Through some research I found this explanation which I believe is the cause (what I'm encountering is below the heading "Value Sought Is Before First Range". The explanation goes on to suggest that I decrease the smallest value of my lookup table so that it is always lower than the value being sought out. This is not possible for my purposes given how my data is structured.

I have two database queries set up, each report a list of timestamps and corresponding values for a given measure. What I wanted to do with the VLOOKUP function was to find a matching value for a value in the first query with one in the second based on the timestamp. The timestamps don't match exactly, so I set the range_lookup parameter to TRUE. Overall, this works very well for me. However, if the second query happens to start at a timestamp later than the timestamps in the first query, I get NA() errors.

To illustrate, here's an example of the problem:

e342054b42a0e3db5619200000a007ac.png


Is there a reliable way to avoid this issue? The only solution I can think of is to have the second query start earlier than the first, but I'd rather avoid this as there is no guarantee that there will be earlier values unless I set a rather wide range for the query which will slow my workbook down considerably.

Any suggestions you all might have would be appreciated,

Thanks,

Dan
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Well, you could make of the IFERROR function to tell it what to do in those situations if which it returns an error.
See: Excel IFERROR Function
 
Upvote 0

Forum statistics

Threads
1,217,365
Messages
6,136,120
Members
449,993
Latest member
Sphere2215

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