+ Reply to Thread
Results 1 to 17 of 17

Looking for a formula that will return multiple results from a lookup separated by a comma

  1. #1
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Looking for a formula that will return multiple results from a lookup separated by a comma

    Hi,

    I have a 3-sheet workbook where I need a cell in sheet 3 to look at the data in Sheet 1 or Sheet 2, and return all instances of the lookup into 1 cell separated by a comma in Sheet 3.
    Attached Files Attached Files
    Last edited by ConanPBG; 11-06-2018 at 01:07 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    Please upload a workbook or a representative cut down copy, anonymised if necessary. It is always easier to advise if we can see your request in its context.

    Show a before and after situation with manually calculated results, explaining which information is data and which is results, and if it's not blindingly obvious how you have arrived at your results some explanatory notes as well.

    Would you also explain the overall process. By that I dpn;t mean tell us wat you're exsiting formulae mean, but tell us what you start with and how you process it to arrive at the results you show.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    I did upload the workbook in the original post.

  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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    I haven't the faintest idea what you want. Please add some manually calculated answers.
    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

  5. #5
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    in sheet 3, I put the request in cell J3. So, I am looking for J4 to show 01-113-A, 16-031-A when looking up A3 in either Sheet 1 or Sheet 2

  6. #6
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    OK. Clear!! One more Q. Can there be MORE THAN 1 match per sheet (thus more than two in total)? If more than1 per sheet, have you any idea how many (roughly)?

  7. #7
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    yes, there can be more than 1. basically, it needs to look at the data from an inventory scan, and pull every sticker where the product was scanned. Ont he example, there is 1 article that is in 34 different stickers (locations).

  8. #8
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    This will need VBA. Is that OK?

  9. #9
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    Sure, if there are no other options

  10. #10
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    With 34.... there are NO other options.


    You didn't say which columns I should be looking at in in sheet 2... so I guessed.


    Please Login or Register  to view this content.
    How to install your new code
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Press Alt+F11 to open the Visual Basic Editor
    Choose Insert > Module
    Edit > Paste the macro into the module that appeared
    Close the VBEditor
    Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


    Then use this array formula in A3:

    =ConcatAll(IF('Sheet 1'!$A$2:$A$79=A3,'Sheet 1'!$B$2:$B$79,""),", ")&", "&ConcatAll(IF('Sheet 2'!$E$2:$E$79=A3,'Sheet 2'!$H$2:$H$79,""),", ")

    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed in the FIRST CELL ONLY by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. After that, the array can be dragged down as normal, to cover the desired range.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use 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 brackets yourself - it won't work...

    Any reason why column I is highlighted in yellow?
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    I highlighted cells in yellow that were formulas for my own sense check. Thank you for this!

  12. #12
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    OK!! I just thought I might have missed something.... again.

    You're welcome.



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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

  13. #13
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    The only issue I see is that it is pulling an extra item... for example, HVKG-APR16930A is only in 2 bins (01-113-A, 16-031-A,), but it is bulling an additional bin: 01-022-A

  14. #14
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    Gimme 5...

  15. #15
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    Sheet 1 Rows 4 and 62 and Sheet 2 row 9.... 3 in total.

  16. #16
    Registered User
    Join Date
    05-03-2017
    Location
    Palm Beach Gardens, FL
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    It only needed to return either that data from Sheet 1 columns A - B OR the data from sheet 2 columns A - B. Sheet 2 is just three separate pivot tables, and it looks like you have it looking at both the 2nd and 3rd pivots.

  17. #17
    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
    43,986

    Re: Looking for a formula that will return multiple results from a lookup separated by a c

    I misread your request. I thought you wanted me to look at BOTH sheets. So, amend the array formula to:

    =ConcatAll(IF('Sheet 1'!$A$2:$A$79=A3,'Sheet 1'!$B$2:$B$79,""),", ")

    and it looks only at Sheet 1.





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

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.
    Attached Files Attached Files

+ 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. [SOLVED] Vlookup or Index to search and return multiple values in one cell separated by a comma
    By Trnecessary in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 10-17-2018, 12:59 PM
  2. Vlookup or Index to search and return multiple values in one cell separated by a comma
    By Trnecessary in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2018, 10:37 AM
  3. Replies: 16
    Last Post: 02-21-2017, 02:10 AM
  4. Replies: 4
    Last Post: 11-16-2015, 05:12 AM
  5. INDEX & MATCH multiple rows to return comma separated cell
    By sifuchi in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-18-2015, 04:36 PM
  6. Replies: 1
    Last Post: 11-10-2011, 12:57 PM
  7. Return Y/N after matching from multiple lookup values separated by comma
    By indoglans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2011, 03:13 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