+ Reply to Thread
Results 1 to 9 of 9

lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return col B

Hybrid View

  1. #1
    Registered User
    Join Date
    07-11-2016
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    85

    lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return col B

    HI Guys,

    I can't find a solution to my problem after browsing through numerous posts and threads. Kindly help me out

    In the sheet attached, i want to get the "Ranking" in column B of sheet 1 by looking up city (col A sheet 1) with col a and B of sheet 2 and return value in col B(ranking)

    Its easy to do a vlookup when the cell contains one value for eg: "Houston" can be looked up from sheet 2

    But some of my cells contain: Houston;Miami;Seattle in one cell and i want to get the value of the city which has the highest rank among the three.

    Is this possible? Let me know if you need more clarity on this. I have attached the excel file with the post.
    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    In B2, enter this array formula:

    =MAX(IF(ISNUMBER(SEARCH(Sheet2!$A$2:$A$16, $A2)), Sheet2!$B$2:$B$16, 0))

    ...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 your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

    Then copy B2 downward to get the rest of the answers.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,175

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    Or try this ...

    =AGGREGATE(14,6,Sheet2!$B$2:$B$16/(SEARCH(Sheet2!$A$2:$A$16,$A2)>0),1)

    Normal enter.

  4. #4
    Registered User
    Join Date
    07-11-2016
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    85

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    WOwww...both solutions worked perfectly fine !! Thanks a ton you guys for your quick responses.

    @Phuocam - Could you breakdown your formula so that i can understand this for future use? i didn't understand why you used 14,6 in the beginning.
    Greatly appreciate all your help

  5. #5
    Registered User
    Join Date
    07-11-2016
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    85

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    Also if i want to give a default ranking value to the unmatched string(which wasn't in sheet 2) how can i do this?

  6. #6
    Registered User
    Join Date
    07-11-2016
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    85

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    I cannot get the formula working on my actual file. Guys any clue why? i have attached the sheet with this post.
    I need to get the score of the cities in col I and display it in col Q.
    Lookup tab is "City Vlookup"
    For the blank values i need to return a default value 80
    For the unmatched cells i need to return a default value 80.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,175

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    Try ...

    =IF(I2="",80,IFERROR(AGGREGATE(14,6,'City Vlookup'!$B$2:$B$31/(SEARCH('City Vlookup'!$A$2:$A$31,I2)>0),1),80))

  8. #8
    Registered User
    Join Date
    07-11-2016
    Location
    USA
    MS-Off Ver
    Microsoft 365
    Posts
    85

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    Pure Genius Phuocam !! That worked. Could you please please break down this formula and expain in 1/2 lines(or as a syntax). I am really eager to learn this part:
    "IFERROR(AGGREGATE(14,6,'City Vlookup'!$B$2:$B$31/(SEARCH('City Vlookup'!$A$2:$A$31,I2)>0),1)"
    many thanks!!

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: lookup multiple values(strings) in a single cell with col A & B(diff sheet) & return c

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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. Return Multiple corresponding values for Single Lookup Value, Horizontally
    By ljhyun89s in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-24-2016, 06:14 PM
  2. Lookup multiple values in different columns and return a single value
    By tanyael in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 07-18-2014, 10:41 AM
  3. Replies: 5
    Last Post: 07-07-2013, 03:39 PM
  4. Replies: 10
    Last Post: 02-19-2013, 12:05 PM
  5. [SOLVED] lookup multiple values of a single cell and return sum of results
    By Zeppelin17 in forum Excel General
    Replies: 7
    Last Post: 08-10-2011, 07:09 PM
  6. Replies: 0
    Last Post: 01-18-2009, 06:11 PM
  7. lookup single value in one sheet, return multiple results from the other sheet
    By cvanoosbree in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-16-2009, 04:23 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