+ Reply to Thread
Results 1 to 17 of 17

VLookup multiple data in one cell outcome desired

  1. #1
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    VLookup multiple data in one cell outcome desired

    Multiple Vlookup in Google Sheets

    I have a Vlookup working for a column with the thing I'm looking for, then two columns in a different sheet with sheetname! where it looks for the thing I'm looking for and gives me back the ID #. So like...
    =VLOOKUP(B2,sheetname!A$2:B$19121,2,FALSE)
    for
    33270 VNY business name 31199
    So B2 is what I'm looking for in the sheetname sheet in two columns where one column is the post ID and one column has what's in B2.

    For a single value it works great.

    But now I have the need to find multiple ids for multiple business codes.

    So let's say I have 30 location codes which match up to 1 business ID.
    So I have a column for a listing with 30 location codes and on the same row the business ID

    This business ID has 30 locations. I want the ID's of all of the locations to show up in one column.The locations are 3 letter codes which are all in one cell.

    So the row/columns look like:
    This is what I have to work with:

    Business Post ID | Business Location 3 letter code
    12345 | ABC, XYZ, RFT, PTR, BBC, QRZ

    In the second sheet is the list of the Business Location 3 letter codes and their Post IDs

    Business Location | Business Location POST ID
    ABC | 56789
    XYZ | 37560
    RFT | 25491
    PTR | 89976
    BBC | 44538
    QRZ | 99852

    The goals is to have a new column which gives me just one cell which tells me all of the business location post IDs for that business Post ID.

    So what I want is something that looks like:

    Business Post ID |. Business Location Post IDs
    12345. | 56789,37560,99852

    Right now for the single version which works great I am using
    =VLOOKUP(B2,sheetname!A$2:B$19121,2,FALSE)
    in which the sheet is the list of businesses with their post ids and B2 is the column with the business 3 letter code. The second sheet (sheetname) has a column of all 3 letter codes with a second column with that 3 letter code's post id.

    Does that make sense? I want to take that theory but have it look up all of the post ids for all of the 3 letter codes in the cell.

    The data is being given to me where it's the business post id and a cell with say 70 3 letter code location, each of which have their own Post id in the other sheet/column.


    If anyone can help I'd sure appreciate it!

    Also I tried this from that link above with
    I tried this =TEXTJOIN(", ",TRUE,IF(B2=sheetname!$A$2:$A$1920,$B$2:$B$1920,"")) where sheetname A is the business 3 letter code and column B is 3 letter code post ID But it didn't work.

    Thanks so much in advance for any help!

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: VLookup multiple data in one cell outcome desired

    =textjoin(", ",True,transpose(filter(sheetname!$B$2:$B$1920,sheetname!$A$2:$A$1920=B2)))
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Thank you!
    I moved things around a little trying to make it more simple. I'm playing with your formula but can't quite get it to work (because I changed it in the meantime of course).

    A. B. C. D.
    TR_ID TR_location_id. AP_location_id AP_ID
    33270 VNY,ABC,DEF,XYZ TN41 13596

    So the 4 columns are now all on one sheet, A,B,C,D.
    B: I want to know the id from column D of if what is in B is found in C

    Desired outcome: A new column with all of the ID's from D if B's are found in C.

    Would you mind tweaking the formula? I keep playing with it and failing.

    Thank you so very much!

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: VLookup multiple data in one cell outcome desired

    I think....

    =textjoin(", ",True,transpose(filter($D$2:$D$1920,$C$2:$C$1920=B2)))

  5. #5
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Well it found results in about 1/3 of them which isn't quite it but close because that is exactly opposite of what we are looking for.
    So the B column will 100% of the time be found in the C column. The C column is the master list of all 3 letter code locations.
    Column A is a subset of those. We want the ids of the locations in C which are held in D.

    I think we are close we just need to switch around some column IDs?

  6. #6
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Oh wow...get this. I'm sure this will make sense to you and I'd love to understand why this worked.
    I had your formula in column G.
    I pasted it again in Column H so I could play with the column letters without breaking what you had and guess what...it gave me the exact right results. Why would putting the same formula in a column one column over make it work?

    However, if I add a second location id to B, so ABC, DEF rather than just ABC (and both are definitely contained in column C) it only gives me the id from D in the results column for the first one, ABC...not idabc,iddef.

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: VLookup multiple data in one cell outcome desired

    Can you share your workbook? Or, at least, a sanitized version of it....

  8. #8
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Attachment 782559
    Maybe easier if you can see it.
    Column C has the master list. Column D is the Post ID of each item in the master list in C.
    Column A is the Post id of the location ids in Column B.
    I want column E or whatever column to show me:
    Look up whats in column B in Column C, and tell me the AP_ID/Column D in the new column of that look up.
    So the first row of the results column should say 13596,13597

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: VLookup multiple data in one cell outcome desired

    "Invalid Attachment specified."

    If you are using Google sheets, post a link to the file in your GDrive. If you are using Excel, post a .xlsx file.

  10. #10
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Sure I have one ready. How should I do it? Publish with a link?

  11. #11
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    It won't let me post the url as I'm new to the forum, it says I have to post a few times. Is there another way to get it to you?

  12. #12
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    I sent it to you in a private message.

  13. #13
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    This turned out the be a solution which works great if anyone else needs it:

    =ARRAYFORMULA(Join(",",VLOOKUP(SPLIT(B2,",",TRUE,TRUE),C:D,2,False)))

  14. #14
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: VLookup multiple data in one cell outcome desired

    I'm glad you got a solution - but next time, post an example data set that shows what you actually have (comma delimited values in the reference cell). Also, posting multiple messages on different websites with the same question is poor answer-board etiquette.

  15. #15
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    OK sorry. Thank you for your time, it's much appreciated.

  16. #16
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

    Re: VLookup multiple data in one cell outcome desired

    Hi @sheetfun11

    now that your post count has reached "10", you should be able to post links on future posts.

    so next time things should go a bit smoother

    have a great day/night
    As a gesture off appreciation, you can click * Add Reputation at the foot of any of the posts of members who helped you reach a solution.

    And finally, was your problem solved? if so, please click Thread Tools above the first post of your enquiry, then select [Solved]

  17. #17
    Registered User
    Join Date
    06-01-2022
    Location
    San Francisco, CA
    MS-Off Ver
    Google Sheets
    Posts
    11

    Re: VLookup multiple data in one cell outcome desired

    Thanks, Jan!

+ 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: 7
    Last Post: 10-27-2020, 08:27 AM
  2. Macro to Split comma separated Cell value using VLOOKUP and arrange in desired order
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2020, 02:26 PM
  3. How would I utilize CHAR(10) to get desired outcome?
    By NMDcorp in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-09-2020, 01:57 PM
  4. [SOLVED] Transpose, Insert Row, VLOOKUP? Desired Data hard to work out...
    By Overkill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-04-2015, 01:48 PM
  5. Desired multiple data into single cell
    By namedas in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-05-2013, 07:26 AM
  6. Desired multiple data into single cell
    By namedas in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-01-2013, 11:22 PM
  7. Comparing 2 different Excel Worksheets & obtaining desired outcome
    By rvkadu1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2013, 01:18 AM

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