+ Reply to Thread
Results 1 to 17 of 17

VBA to return multiple matching values into a single cell

  1. #1
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    VBA to return multiple matching values into a single cell

    Hello,

    Plan sheet - I got this file which returns me a matching route number referring to two criteria.
    This is the sheet i use data fr sheet - where sheet plan is pulling the data from.

    Problem I need to return multiple values into single cell if the criteria has matched. I don't know if this is possible working with only formulas and I have found a VBA which perfectly serves my needs but it's only matching to one criteria rather that for two. Could please have someone a look at it and help me to fit it into my spreadsheet?

    Please Login or Register  to view this content.
    Link to VBA code posted: https://superuser.com/questions/5362...ultiple-values
    Attached Files Attached Files

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    Will Column A on worksheets(This is the sheet i use data sheet) only contain the numbers for the staging or will there also be other numbers in the cell. I could just use the worksheets(this is where I paste data) to create the output on the Plan sheet.
    Last edited by mike7952; 04-29-2017 at 03:15 PM.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    If it's possible to generate the table straight from the sheet where I paste data, go for it.

    Sheet this is the sheet i use data fr is only for index match formula to work. If you can make Plan sheet to work straight from the sheet where i paste data in then its very good and it means that I can avoid from having extra sheets that contain the same information with some extra columns.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    Give this wb a try.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    WoW!!! Thank you very much! Exactly what i have requested.

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    Here is the small adjustment you wanted. Click hyperlink in Cell A1 to run Macro. Adjustments are highlighted in red.

    Please Login or Register  to view this content.
    Updated Workbook
    Attached Files Attached Files
    Last edited by mike7952; 05-02-2017 at 02:32 PM.

  7. #7
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    staging02.JPG

    For some reason it returns matching DSP only for 3,4 and 5 columns. Could you please have a look at this?

  8. #8
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    My bad fixed the code in previous post. See code highlighted in green. Here

  9. #9
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    stagingv02.JPG

    now code duplicates route codes

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    My bad again lol, I copied and pasted wrong, This should do it, had and extra aStaging(i, 2) like below.
    Also edited the previous code in Post #5

    Change this:
    Please Login or Register  to view this content.
    To this:
    Please Login or Register  to view this content.
    Last edited by mike7952; 05-02-2017 at 02:30 PM.

  11. #11
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    Thank you my dear. Cold and rainy greetings from UK to sunny Florida!

  12. #12
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    Your welcome, and thanks for the rep. And Florida is warm and rainy here today.

    Added a Custom Tab in the Workbook below to the end of your Menus Tab. See Image below.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by mike7952; 05-02-2017 at 03:29 PM.

  13. #13
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    Thank you very much for another update. But may I ask you for something more? I would like the spreadsheet to suggest us me the best staging area? I have added sheet called Staging areas with their locations and also added another column in the wave plan where it says which location dsp prefers the most. Would it be to much to ask from you?
    Attached Files Attached Files

  14. #14
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    Quote Originally Posted by ChipsSlave View Post
    Thank you very much for another update. But may I ask you for something more? I would like the spreadsheet to suggest us me the best staging area? I have added sheet called Staging areas with their locations and also added another column in the wave plan where it says which location dsp prefers the most. Would it be to much to ask from you?
    Not sure that I'm following you correctly. Can you give me some more insight on what you are requesting?

  15. #15
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    Attachment 516223

    I would like spreadsheet to suggest me where is the best place to stage the route. If FDTL primary staging location is front then check if 31 staging area is empty then suggest in 31 otherwise check 32 if occupied check 33. If none found in front look for free space in secondary location.
    Attached Files Attached Files

  16. #16
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: VBA to return multiple matching values into a single cell

    In your uploaded example what is to happen with C1/WCD in row 3. What about A2/UKED,C2/WCDL in the next row. I know its easy for you to look at and know what it want, but I'm not seeing your ALL of your logic. Can you explain a little more?

  17. #17
    Forum Contributor
    Join Date
    09-21-2016
    Location
    UK
    MS-Off Ver
    2016
    Posts
    131

    Re: VBA to return multiple matching values into a single cell

    Hi,

    I have uploaded another file with much more detail and a sheet of what I would like to be done.
    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] formula to return multiple values in single cell not working
    By judiejean in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-11-2017, 11:45 AM
  2. Replies: 3
    Last Post: 03-10-2017, 07:56 PM
  3. Return multiple values to single cell from array
    By olliecottam in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 01-04-2017, 06:10 AM
  4. [SOLVED] vLookup multiple values separated by ";" in single cell / return result in single cell
    By Tunesmith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2015, 12:02 PM
  5. [SOLVED] How to return multiple values to a single cell based on multiple criteria
    By lwallace in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-20-2014, 06:32 AM
  6. How to return multiple values from an array in a single cell?
    By fkalinx in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-03-2014, 04:16 AM
  7. How to return multiple IF values in a single cell?
    By macmanjpc in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-15-2008, 08:54 AM

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