ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Embedded vlookup question (https://www.excelbanter.com/excel-programming/356097-embedded-vlookup-question.html)

[email protected]

Embedded vlookup question
 
I have a vlookup that isn't working because it would pull back multiple
rows. How do I tell the vlookup to pull back the row with the most
recent date?

Example of existing query:

=VLOOKUP($A$22,'Tgt Inv'!$B:$F,4,FALSE)

Will pull back following rows since they all have 302 as the delimiter.


NA 302 2/14/2006 340 670 4.6
NA 302 1/18/2006 304 670 4
NA 302 12/18/2005 340 670 4.3
NA 302 1/26/2004 340 670 4

How do I embedd something in it to pull the row with the latest date--
or in this example-- the one with the 2/14/06 date?

Help?

Thanks!
knox5731


Tom Ogilvy

Embedded vlookup question
 
Vlookup will only pull back the value for the row with the first matching
value for the lookup column. So in the example you show, that would be the
correct result.

As long as your data is sorted by descending date, it should work.

--
Regards,
Tom Ogilvy


" wrote:

I have a vlookup that isn't working because it would pull back multiple
rows. How do I tell the vlookup to pull back the row with the most
recent date?

Example of existing query:

=VLOOKUP($A$22,'Tgt Inv'!$B:$F,4,FALSE)

Will pull back following rows since they all have 302 as the delimiter.


NA 302 2/14/2006 340 670 4.6
NA 302 1/18/2006 304 670 4
NA 302 12/18/2005 340 670 4.3
NA 302 1/26/2004 340 670 4

How do I embedd something in it to pull the row with the latest date--
or in this example-- the one with the 2/14/06 date?

Help?

Thanks!
knox5731



[email protected]

Embedded vlookup question
 
Nope that didn't work...it still comes back with 'NA', I'm not sure
what is going on.......and sometimes it pulls the row above its data.


Tom Ogilvy wrote:
Vlookup will only pull back the value for the row with the first matching
value for the lookup column. So in the example you show, that would be the
correct result.

As long as your data is sorted by descending date, it should work.

--
Regards,
Tom Ogilvy


" wrote:

I have a vlookup that isn't working because it would pull back multiple
rows. How do I tell the vlookup to pull back the row with the most
recent date?

Example of existing query:

=VLOOKUP($A$22,'Tgt Inv'!$B:$F,4,FALSE)

Will pull back following rows since they all have 302 as the delimiter.


NA 302 2/14/2006 340 670 4.6
NA 302 1/18/2006 304 670 4
NA 302 12/18/2005 340 670 4.3
NA 302 1/26/2004 340 670 4

How do I embedd something in it to pull the row with the latest date--
or in this example-- the one with the 2/14/06 date?

Help?

Thanks!
knox5731




Dave Peterson

Embedded vlookup question
 
Debra Dalgleish has some troubleshooting tips at:
http://contextures.com/xlFunctions02.html#Trouble

It could be that you have 302 as a number in one location and text in the other
-- or leading/trailing spaces in that cell (along with the 302).



wrote:

Nope that didn't work...it still comes back with 'NA', I'm not sure
what is going on.......and sometimes it pulls the row above its data.

Tom Ogilvy wrote:
Vlookup will only pull back the value for the row with the first matching
value for the lookup column. So in the example you show, that would be the
correct result.

As long as your data is sorted by descending date, it should work.

--
Regards,
Tom Ogilvy


" wrote:

I have a vlookup that isn't working because it would pull back multiple
rows. How do I tell the vlookup to pull back the row with the most
recent date?

Example of existing query:

=VLOOKUP($A$22,'Tgt Inv'!$B:$F,4,FALSE)

Will pull back following rows since they all have 302 as the delimiter.


NA 302 2/14/2006 340 670 4.6
NA 302 1/18/2006 304 670 4
NA 302 12/18/2005 340 670 4.3
NA 302 1/26/2004 340 670 4

How do I embedd something in it to pull the row with the latest date--
or in this example-- the one with the 2/14/06 date?

Help?

Thanks!
knox5731



--

Dave Peterson


All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com