+ Reply to Thread
Results 1 to 15 of 15

Finding second to last value using vlookup match or index match...

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Finding second to last value using vlookup match or index match...

    Hi,
    i have searched a lot but in everywhere it finds 1st, 2nd, 3rd value and so on. I want to find 2nd last non blank value using index match or vlookup match function.
    example
    sheet2
    A B
    1 Name Due
    2 John 350
    3 Alan 250
    4 Chris 100
    5 John 650
    6 Chris 75
    7 Alan 550
    8 John 125

    Sheet1
    A B
    1 Name Due
    2 John
    3 Alan
    4 Chris

    I have attached sample workbook also.
    I want that on Sheet1 column B should be calculated.
    John 650
    Alan 250
    Chris 100

    Sorry for my bad English.

    Please Help. Thanks!!!
    Attached Files Attached Files
    Last edited by gr8spot; 06-20-2015 at 06:39 AM.

  2. #2
    Forum Expert boopathiraja's Avatar
    Join Date
    07-12-2013
    Location
    Coimbatore,TamilNadu, India
    MS-Off Ver
    Excel 2007, 2013, 2016, 365
    Posts
    1,455

    Re: Finding second to last value using vlookup match or index match...

    Hi

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Click just below left if it helps, Boo?ath?

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,206

    Re: Finding second to last value using vlookup match or index match...

    Please supply sample workbook with results: is 350 applied to every name ? or if there is only one value for a name, is that applied i.e Alan=250?

  4. #4
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Finding second to last value using vlookup match or index match...

    I have attached sample workbook. please find the attachment.

  5. #5
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Finding second to last value using vlookup match or index match...

    B2
    Please Login or Register  to view this content.
    =IF(COUNTIF(Sheet2!$A$2:$A$7,$A2)>1,INDEX(Sheet2!$B:$B,LARGE(INDEX((Sheet2!$A$2:$A$7=$A2)*ROW(Sheet2!$A$2:$A$7),0),2)),"")
    try this and copy towards down
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  6. #6
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Finding second to last value using vlookup match or index match...

    Quote Originally Posted by nflsales View Post
    B2
    Please Login or Register  to view this content.
    =IF(COUNTIF(Sheet2!$A$2:$A$7,$A2)>1,INDEX(Sheet2!$B:$B,LARGE(INDEX((Sheet2!$A$2:$A$7=$A2)*ROW(Sheet2!$A$2:$A$7),0),2)),"")
    try this and copy towards down
    I want 2nd last value of column. lets say if add another entry in sheet 2 john 125 then B2 result should be 650.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Finding second to last value using vlookup match or index match...

    with a helpcolumn and a pivot table.

    see the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  8. #8
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Finding second to last value using vlookup match or index match...

    thanks oeldere for reply.
    But this doesnt solve the problem. the result i am expecting is something else. this is totally different.

  9. #9
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Finding second to last value using vlookup match or index match...

    Perhaps something like this? using array formula.........
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Finding second to last value using vlookup match or index match...

    Thank you so much azumi. you really saved my day!!

  11. #11
    Forum Expert azumi's Avatar
    Join Date
    12-10-2012
    Location
    YK, Indonesia
    MS-Off Ver
    Excel 2019
    Posts
    2,368

    Re: Finding second to last value using vlookup match or index match...

    Glad it works......thanks for the feedback

  12. #12
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Finding second to last value using vlookup match or index match...

    =IF(COUNTIF(Sheet2!$A:$A,$A2)>1,INDEX(Sheet2!$B:$B,LARGE(INDEX((Sheet2!$A:$A=$A2)*ROW(Sheet2!$A:$A),0),2)),"")
    Please Login or Register  to view this content.
    try this

  13. #13
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding second to last value using vlookup match or index match...

    Try this...

    Sheet2
    A
    B
    1
    Name
    Due
    2
    John
    350
    3
    Alan
    250
    4
    Chris
    100
    5
    John
    650
    6
    Chris
    75
    7
    Alan
    550
    8
    John
    125


    Sheet1
    A
    B
    1
    Name
    Due
    2
    John
    650
    3
    Alan
    250
    4
    Chris
    100


    This array formula** entered in B2 and copied down:

    =IFERROR(INDEX(Sheet2!B:B,LARGE(IF(Sheet2!A$2:A$8=A2,ROW(Sheet2!A$2:A$8)),2)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Edit: Removed this statement as it does not apply in this application.
    Last edited by Tony Valko; 06-20-2015 at 03:33 PM.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  14. #14
    Registered User
    Join Date
    03-05-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Finding second to last value using vlookup match or index match...

    Both worked. thanks guys.

  15. #15
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Finding second to last value using vlookup match or index match...

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 03-06-2015, 03:20 PM
  2. [SOLVED] Finding unique occurences via Vlookup/Match/Index
    By jontherev in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-01-2014, 01:10 PM
  3. vlookup for finding out wrongly spelled names and yet match the match
    By catchnanan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2014, 04:29 PM
  4. [SOLVED] Multi-conditional INDEX, MATCH, VLOOKUP... finding Lat & Long in a geographic square grid
    By heinemannj in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-03-2013, 12:38 PM
  5. Replies: 13
    Last Post: 12-13-2012, 11:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1