+ Reply to Thread
Results 1 to 4 of 4

How to search a table when a cell has multiple search values

  1. #1
    Registered User
    Join Date
    06-08-2009
    Location
    Michigan
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    29

    How to search a table when a cell has multiple search values

    Hello,
    I am using Microsoft 365 Apps for Enterprise

    I have a table with 2 columns: Fruit and Quantity. The "Fruit" column is unique.
    For example:
    Fruit Quantity
    Orange 10
    Apple 2
    Melon 13
    Banana 5

    I have a cell that has the fruit names separated by a "-".
    I need to return back the quantity for each fruit either all in 1 cell separated by a delimiter or one quantity per column. Whichever is easier.
    Unfortunately, I cannot use VBA.

    For example:
    A1=
    -Melon-Apple-Orange-

    Return values:
    B1=13;2;10; (let say the delimiter is ; )
    OR
    B1=13
    B2=2
    B3=10

    If the cell has only 1 fruit, I can easily use vlookup to return back the quantity for that fruit.
    Problem is the cell has multiple fruits separated by a "-".
    Since I cannot use VBA, how do I extract each fruit name and do the search repeatedly?

    Please help.

  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,101

    Re: How to search a table when a cell has multiple search values

    One way:

    =TEXTJOIN(", ",,VLOOKUP(FILTERXML(SUBSTITUTE(SUBSTITUTE(LEFT(G4,LEN(G4)-1),"-","<A><B>",1),"-","</B><B>")&"</B></A>","//B"),A:B,2,FALSE))
    Attached Files Attached Files
    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

  3. #3
    Registered User
    Join Date
    06-08-2009
    Location
    Michigan
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    29

    Re: How to search a table when a cell has multiple search values

    Thank you very much for your help, Glenn. This is perfect!!!

  4. #4
    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,101

    Re: How to search a table when a cell has multiple search values

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and 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. Search for multiple values in one table in another
    By Shauna5115 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-07-2020, 02:51 AM
  2. Search table to return multiple values
    By Hayzylou in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-11-2017, 07:10 AM
  3. Replies: 10
    Last Post: 09-16-2015, 11:25 PM
  4. Search for Values that Multiple Search Words Share
    By Drew67209 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2014, 05:54 AM
  5. Search a table with multiple search inputs and return all matches
    By JDI in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-16-2014, 12:23 PM
  6. [SOLVED] How to ask formula to search for multiple values within one search?
    By Buzz57 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-04-2014, 11:14 PM
  7. [SOLVED] Search for multiple string values in the first row of a table and format column values.
    By Excel_junky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-12-2013, 12:48 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