+ Reply to Thread
Results 1 to 10 of 10

Pulling the second correct result from Vlookup.

  1. #1
    Registered User
    Join Date
    02-11-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    98

    Pulling the second correct result from Vlookup.

    Is there a way to use either Vlookup or maybe SUMPRODUCT to pull the second or third qualifying result instead of the first result?

    If so, how.

    If not, then what can I use to automate a search of data that has more than one instance of qualifying information.

    For an example, see the spreadsheet.
    Attached Files Attached Files
    Excel: Not my profession, but useful in it.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Pulling the second correct result from Vlookup.

    Try this array formula:

    =IFERROR(INDEX($I$4:$I$15,SMALL(IF($B$27=$A$4:$A$15,ROW($A$4:$A$15)-ROW($A$4)+1),ROWS($1:1))),"")

    Array Formulae are a little different from ordinary formulas in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly braces { } appear around the outside of your formula. If you do not CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly braces yourself - it won't work...

    the way you have imported this data from you Mass Spectrometer has made this a bit more difficult for you to manage as there are merged cells everywhere. Is it an HP or Waters? Masslynx is much easier to work with!!
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Pulling the second correct result from Vlookup.

    Try this one

    Formula: copy to clipboard
    Please Login or Register  to view this content.



    You should really get rid of all merged cells. They are nothing but trouble.
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    02-11-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Pulling the second correct result from Vlookup.

    Glenn
    It is an Agilent LCMS.

    The formula you gave returns the first result. How do I manipulate it to return the 2nd, 3rd, and so on of the same sample name?

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Pulling the second correct result from Vlookup.

    Mmmm. You must be doing something wrong...

    Agilent - sorry, yes that's the one. Their software is horrible. You'd be better to de-merge everything you D/L from the instrument BEFORE you do any data manipulation. Are you looking to do ion ratios, etc?

    In the meantime. here's the sheet, with the array formula in place....
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    02-11-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Pulling the second correct result from Vlookup.

    Alkey,

    Your formula gives me the 2nd result, but if I kill all the merged cells and extend the range to the rest of the table, I get the 4th result. If I change your "2" to a "1" I get the 3rd result. What do I need to do to get each of the results, 1st through 4th?

  7. #7
    Registered User
    Join Date
    02-11-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Pulling the second correct result from Vlookup.

    Glenn,
    Ok, that's better. Now I understand where I need to change the numbers to manipulate the formula. Before, I was trying to change the "+1" to a "+2", and that didn't work. Then I tried changing BOTH of the row numbers at the end, and that didn't work either. Now I see, I only change the last number.

    No, not looking at Ion ratios. I have to use the area to calculate the concentration, then the second area to create a second, separate concentration. Then I have to calculate a CV value between the 2. That is to determine how well the injector is performing.

    Thanks.
    Last edited by timmtamm; 10-29-2015 at 03:36 PM.

  8. #8
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Pulling the second correct result from Vlookup.

    If you unmerge cells you can utilize the entire column and get the second value

    as regular formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-11-2009
    Location
    Salt Lake City, Utah
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Pulling the second correct result from Vlookup.

    Alkey,
    That works nicely. Thank you.
    I see that the "2" is the result row to pull from.

    Out of curiosity, what are the 15 and 6? What do they do?

    edit: never mind. I seem to have found the explanation for the 15 and 6 in excel.
    Last edited by timmtamm; 10-29-2015 at 04:31 PM.

  10. #10
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Pulling the second correct result from Vlookup.

    Quote Originally Posted by timmtamm View Post
    Alkey,
    That works nicely. Thank you.
    I see that the "2" is the result row to pull from.

    Out of curiosity, what are the 15 and 6? What do they do?
    Aggregate is a multi-purpose function that includes 19 different very useful functions. 15 is SMALL and 6 is to ignore errors. This combination allows to enter an array formula without use of CTRL+SHIFT+ENTER key combination. Aggregate was first introduced in Excel 2010.

    Please don't forget to thank those who helped by clicking on Add Reputation * and please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools-> Mark 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: 15
    Last Post: 11-25-2014, 08:14 AM
  2. [SOLVED] Code result wrong but formula correct result
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2014, 12:26 PM
  3. VLOOKUP is not Pulling from the Correct Sheet
    By randalbg in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-01-2013, 09:46 AM
  4. INDEX ROW Not Pulling Correct Data
    By autoworke in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-29-2013, 03:16 PM
  5. Replies: 1
    Last Post: 09-17-2012, 09:35 AM
  6. Replies: 3
    Last Post: 05-17-2008, 05:25 AM
  7. Pass path result from FilePicker to vlookup with correct syntax
    By sabs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2005, 06:44 PM

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