Rob: I appreciate your response. I believe I understand vlookup from a
syntax and set up perspective. What I don't understand is what would cause
the function to find the match on row 20 for instance and return the required
value from row 19. Please attempt to address that issue. Thanks.
> Rob: I appreciate your response. I believe I understand vlookup from a
> syntax and set up perspective. What I don't understand is what would
> cause
> the function to find the match on row 20 for instance and return the
> required
> value from row 19. Please attempt to address that issue. Thanks.
I don't believe this is what's happening. Because you have verified that
vlookup is giving you a #N/A error when you use False as the last argument,
you have no exact match. When you omit the last argument or set it to True,
vlookup will return the largest value that is less than the value you're
looking for if it cannot find an exact match.
This only works properly when the lookup column is sorted in ascending
order. Assuming your data is sorted this way, the behavior you are
experiencing is exactly what you would expect if there is no exact match.
Vlookup is returning the data from the row above the one you think should
match because there is no exact match and that row holds the largest value
that is less than the lookup value.

Signature
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/
* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
DJC - 26 Apr 2005 13:22 GMT
Rob: You're absolutely right. The problem is my values which I have
imported from an AS/400 application came in with spaces to the right of the
number so I was trying to match 1234-56{SPACE}{SPACE}{SPACE} with 1234-56 and
obviously not matching. How do I get rid of the spaces to the right? They
are different amounts in the different values. Thanks. You've been a great
help so far. DJC
> > Rob: I appreciate your response. I believe I understand vlookup from a
> > syntax and set up perspective. What I don't understand is what would
[quoted text clipped - 15 lines]
> match because there is no exact match and that row holds the largest value
> that is less than the lookup value.
DJC - 26 Apr 2005 14:02 GMT
Rob: I have subsequently used the trim function and everthing works as it
should. Thanks for your help. DJC
> Rob: You're absolutely right. The problem is my values which I have
> imported from an AS/400 application came in with spaces to the right of the
[quoted text clipped - 22 lines]
> > match because there is no exact match and that row holds the largest value
> > that is less than the lookup value.
Rob Bovey - 26 Apr 2005 16:23 GMT
Glad you got it to work. My free Excel Utilities package, which you can
download from the web site below my signature, contains a feature that will
trim all spaces from the current selection. You can just select all your
data, choose the Utilities/Selection Utilities/Trim Selection menu and it
will remove all of the trailing spaces from your data without requiring you
to use any worksheet functions.

Signature
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/
* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
> Rob: I have subsequently used the trim function and everthing works as it
> should. Thanks for your help. DJC
[quoted text clipped - 38 lines]
>> > value
>> > that is less than the lookup value.