Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 192
Default VLOOKUP and Return Last 2 Values

Here is an example table...
Date | Name | Score |
5/20/2009 | Nick | 95 |
5/21/2009 | Jon | 96 |
5/22/2009 | Jon | 97 |
5/23/2009 | Jon | 98 |
5/24/2009 | Jon | 99 |
5/25/2009 | Nick | 72 |
5/26/2009 | Jon | 45 |
5/27/2009 | Nick | 30 |

I would like to create a summary page that has "Nick" and "Jon" and returns
their last 2 most recent scores to track their current trend. So for Nick,
the result would be:
Nick
Most Recent: 30
Second Most Recent: 72
Jon
Most Recent: 45
Second Most Recent: 99

There will never be duplicate dates. The primary key is basically the date
column. I will continue to add dates on the data dump table so it will need
to have the opportunity to expand. I've searched through this for a while
and can't find my answer. Any help is greatly appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default VLOOKUP and Return Last 2 Values

=VLOOKUP(LARGE(IF($B$2:$B$9="Nick",$A$2:$A$9),ROWS ($1:1)),$A$2:$C$9,3,0)

ctrl+shift+enter, not just enter
copy down


"Nick" wrote:

Here is an example table...
Date | Name | Score |
5/20/2009 | Nick | 95 |
5/21/2009 | Jon | 96 |
5/22/2009 | Jon | 97 |
5/23/2009 | Jon | 98 |
5/24/2009 | Jon | 99 |
5/25/2009 | Nick | 72 |
5/26/2009 | Jon | 45 |
5/27/2009 | Nick | 30 |

I would like to create a summary page that has "Nick" and "Jon" and returns
their last 2 most recent scores to track their current trend. So for Nick,
the result would be:
Nick
Most Recent: 30
Second Most Recent: 72
Jon
Most Recent: 45
Second Most Recent: 99

There will never be duplicate dates. The primary key is basically the date
column. I will continue to add dates on the data dump table so it will need
to have the opportunity to expand. I've searched through this for a while
and can't find my answer. Any help is greatly appreciated!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default VLOOKUP and Return Last 2 Values

Non array formula

In D2: =LOOKUP(2,1/(B2:B9="Nick"),C2:C9)
In D3: =LOOKUP(2,1/((B2:B9="Nick")*(C2:C9<D2)),C2:C9)

Just press Enter


"Nick" wrote:

Here is an example table...
Date | Name | Score |
5/20/2009 | Nick | 95 |
5/21/2009 | Jon | 96 |
5/22/2009 | Jon | 97 |
5/23/2009 | Jon | 98 |
5/24/2009 | Jon | 99 |
5/25/2009 | Nick | 72 |
5/26/2009 | Jon | 45 |
5/27/2009 | Nick | 30 |

I would like to create a summary page that has "Nick" and "Jon" and returns
their last 2 most recent scores to track their current trend. So for Nick,
the result would be:
Nick
Most Recent: 30
Second Most Recent: 72
Jon
Most Recent: 45
Second Most Recent: 99

There will never be duplicate dates. The primary key is basically the date
column. I will continue to add dates on the data dump table so it will need
to have the opportunity to expand. I've searched through this for a while
and can't find my answer. Any help is greatly appreciated!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 192
Default VLOOKUP and Return Last 2 Values

Teethless, worked perfectly! I'm trying to understand the logic, though, and
not really understanding. Can you explain what this function is actually
doing? I think the issue I have is with the 1/*** part. Doesn't make sense.

"Teethless mama" wrote:

Non array formula

In D2: =LOOKUP(2,1/(B2:B9="Nick"),C2:C9)
In D3: =LOOKUP(2,1/((B2:B9="Nick")*(C2:C9<D2)),C2:C9)

Just press Enter


"Nick" wrote:

Here is an example table...
Date | Name | Score |
5/20/2009 | Nick | 95 |
5/21/2009 | Jon | 96 |
5/22/2009 | Jon | 97 |
5/23/2009 | Jon | 98 |
5/24/2009 | Jon | 99 |
5/25/2009 | Nick | 72 |
5/26/2009 | Jon | 45 |
5/27/2009 | Nick | 30 |

I would like to create a summary page that has "Nick" and "Jon" and returns
their last 2 most recent scores to track their current trend. So for Nick,
the result would be:
Nick
Most Recent: 30
Second Most Recent: 72
Jon
Most Recent: 45
Second Most Recent: 99

There will never be duplicate dates. The primary key is basically the date
column. I will continue to add dates on the data dump table so it will need
to have the opportunity to expand. I've searched through this for a while
and can't find my answer. Any help is greatly appreciated!

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,180
Default VLOOKUP and Return Last 2 Values

Excel 2007 PivotTable
No formulas of any kind needed.
Added data expands results automatically.
http://www.mediafire.com/file/cozimjrz5gn/07_10_09.xlsx



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 192
Default VLOOKUP and Return Last 2 Values

I tried that but I could not figure out a way for it to return the most
recent value for each person let alone the second to last value for each
person. Teethless's method worked flawlessly.

"Herbert Seidenberg" wrote:

Excel 2007 PivotTable
No formulas of any kind needed.
Added data expands results automatically.
http://www.mediafire.com/file/cozimjrz5gn/07_10_09.xlsx


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using H/VLOOKUP to return multiple values Hennessy Excel Discussion (Misc queries) 2 March 25th 09 06:38 PM
Vlookup Return Multiple Values Ripper Excel Discussion (Misc queries) 3 April 25th 08 07:31 PM
How do I return Multiple values using VLookup? Sean Excel Worksheet Functions 1 June 12th 07 12:45 PM
vlookup one value and return multiple values Lisa Excel Discussion (Misc queries) 3 April 10th 07 04:44 PM
vlookup function return all values j2thea Excel Worksheet Functions 20 November 2nd 05 10:32 PM


All times are GMT +1. The time now is 08:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"