+ Reply to Thread
Results 1 to 13 of 13

VLOOKUP for same value with multiple results

  1. #1
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    VLOOKUP for same value with multiple results

    Hi All,

    I recently found an error in my formula below that skipped over the same name though it had a different correlated value. It should have brought back N/A instead of the same result as the one above it. I have attached the exampel with fake names for use. Thank you for your ideas! I am sure its a simple fix, but appreciate the help.

    =VLOOKUP(A2&"*",'2'!A:B,2,FALSE)

  2. #2
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    Please see attached!
    Attached Files Attached Files

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,705

    Re: VLOOKUP for same value with multiple results

    I think you forgot the attachment. The yellow banner at the top of the screen gives details of how to do this.

    Pete

    EDIT - Ah, I see you have done this now.

    Pete

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: VLOOKUP for same value with multiple results

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

  5. #5
    Registered User
    Join Date
    12-04-2020
    Location
    Bangkok
    MS-Off Ver
    365
    Posts
    61

    Re: VLOOKUP for same value with multiple results

    Please try,

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

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: VLOOKUP for same value with multiple results

    A different approach which may be more recalculation efficient.

    Your list of names in '1'!A2:A... could have multiple instances of the same name. If you want only the 1st/topmost to return a VLOOKUP value, try

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

    Fill down as far as needed.

  7. #7
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    This one worked, but only for two rows. How can we edit to make it for as far as we need to drag it down?

    =IFERROR(INDEX('2'!$B$2:$B$3,AGGREGATE(15,6,(ROW('2'!$A$2:$A$3)-ROW('2'!$A$2)+1)/('2'!$A$2:$A$3='1'!A2),COUNTIF($A$2:A2,A2))),"N/A")

  8. #8
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    The same occured with the first reply. I will need one of these to apply to as many applicable rows as possible. I apologize if the example was misleading.

    =IF(COUNTIF(A$2:A2,A2&"*")=1,VLOOKUP(A2&"*",'2'!A:B,2,FALSE),NA()).

  9. #9
    Registered User
    Join Date
    12-04-2020
    Location
    Bangkok
    MS-Off Ver
    365
    Posts
    61

    Re: VLOOKUP for same value with multiple results

    You can extend the formula to the last row or some row much further as below.

    =IFERROR(INDEX('2'!$B$2:$B$10000,AGGREGATE(15,6,(ROW('2'!$A$2:$A$10000)-ROW('2'!$A$2)+1)/('2'!$A$2:$A$10000='1'!A2),COUNTIF($A$2:A2,A2))),"N/A")

  10. #10
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    The issue witht he above occurs when I have three names in a row with different items. With the formula above, sheet 1 skipped over an item that was supposed to be "N/A", replaced it with a match from Line 2, and line 3 was N/A instead. I have attached an example.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    Quote Originally Posted by phatdear View Post
    You can extend the formula to the last row or some row much further as below.

    =IFERROR(INDEX('2'!$B$2:$B$10000,AGGREGATE(15,6,(ROW('2'!$A$2:$A$10000)-ROW('2'!$A$2)+1)/('2'!$A$2:$A$10000='1'!A2),COUNTIF($A$2:A2,A2))),"N/A")

    The issue witht he above occurs when I have three names in a row with different items. With the formula above, sheet 1 skipped over an item that was supposed to be "N/A", replaced it with a match from Line 2, and line 3 was N/A instead. I have attached an example.

  12. #12
    Registered User
    Join Date
    12-04-2020
    Location
    Bangkok
    MS-Off Ver
    365
    Posts
    61

    Re: VLOOKUP for same value with multiple results

    Not really sure if this is what you want. Try this,

    =IFERROR(INDEX('2'!$B$2:$B$10000,AGGREGATE(15,6,(ROW('2'!$A$2:$A$10000)-ROW('2'!$A$2)+1)/('2'!$A$2:$A$10000='1'!A2)/('2'!$B$2:$B$10000='1'!B2),COUNTIFS($A$2:A2,A2,$B$2:B2,B2))),"N/A")

    or if the data are unique, then maybe

    =IFERROR(LOOKUP(9^9,SEARCH('1'!A2,'2'!$A$2:$A$10000)+SEARCH('1'!B2,'2'!$B$2:$B$10000),'2'!$B$2:$B$10000),"N/A")

    If these are not what you are looking for. Please attach a file with more sample data and expected results.

  13. #13
    Registered User
    Join Date
    06-09-2020
    Location
    USA
    MS-Off Ver
    2016
    Posts
    27

    Re: VLOOKUP for same value with multiple results

    That seemed to fix it (the second formula). I do have unique items and it lined up the way I preferred for our report. Thank you again for all the help!

+ 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. Vlookup multiple results
    By tpracsg in forum Excel General
    Replies: 1
    Last Post: 09-09-2020, 06:06 AM
  2. [SOLVED] Vlookup with multiple results and multiple sheets in Excel
    By Philangr8 in forum Excel General
    Replies: 6
    Last Post: 11-29-2016, 07:01 PM
  3. [SOLVED] VLookUP with multiple results.
    By vetrox in forum Excel General
    Replies: 9
    Last Post: 03-16-2016, 11:17 PM
  4. Help using vlookup to return multiple results for one vlookup value
    By Akmon in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-27-2015, 06:00 AM
  5. [SOLVED] using Vlookup with multiple results and averaging the results.
    By xatomicx in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2015, 10:19 AM
  6. Vlookup, multiple row results
    By darvistor in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-01-2011, 06:30 PM
  7. Multiple Results for VLookUp
    By sighlent1 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-12-2009, 01:09 PM

Tags for this Thread

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