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:
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
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:

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