+ Reply to Thread
Results 1 to 12 of 12

Vlookup and return the nth value

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Vlookup and return the nth value

    Hi all

    I did a search on this problem but none seemed to apply so far. The question is to retrieve the last 3 values of a search criteria from a set of data, kind of a Vlookup function with a twist.
    I included a small sample file which will serve to define the question much better. Thanks in advance for your help.
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Vlookup and return the nth value

    hi ant1905, try this array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    Last edited by benishiryo; 03-14-2013 at 03:31 AM. Reason: added file

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    Hello Benishiryo

    Thank you for your help. I got a NAME error... Still checking where it went wrong since I had to translate the formula..

  4. #4
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    Benishiryo just as I suspected I have done a translation mistake now its all good ... thank you so much
    what if there is only one value next to e.g. aaa then it returns an error... seems like I gotta have at least 3 values next to the search criteria to get it working
    is that correct?

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Vlookup and return the nth value

    using Excel 2007 & above, you can use IFERROR to counter errors:
    =IFERROR(MyFormula,"")

  6. #6
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    Excellent! Much appreciated Benishiryo. Sincere thanks .

  7. #7
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    Hi all,

    I tried to modify the above formula for a more simple mission but I think I got mixed up somewhere along the way ....

    I am trying to retrieve the last 3 numericly occupied cells in a row. Any help is most appreciated. Thanks in advance

    Sample file attached
    Attached Files Attached Files

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup and return the nth value

    Try this

    In T4

    =INDEX($C4:$Q4;MATCH(9,99999999999999E+307;$C4:$Q4)-COLUMN(B4))

    In U4

    =INDEX(C4:Q4;MATCH(9,99999999999999E+307;C4:Q4)-COLUMN(A4))

    In V4

    =INDEX(C4:Q4;MATCH(9,99999999999999E+307;C4:Q4))

    Copy down as you need.

    ** Change ALL semi colons in my formula to comma, if you have to do it. Also the comma after first 9 to .
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  9. #9
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    Thanks a million Fotis ...

  10. #10
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Vlookup and return the nth value

    ....................

  11. #11
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Vlookup and return the nth value

    try this too:
    =IFERROR(INDEX($C4:$Q4,LARGE(IF($C4:$Q4<>"",COLUMN($C4:$Q4)-COLUMN($C4)+1),4-COLUMNS($T4:T4))),"")

    also an array formula
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    03-28-2012
    Location
    Istanbul
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Vlookup and return the nth value

    thank you benishiryo

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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