Multiple lookup values returned into one cell

  • Hi


    I require assistance in developing some VBA code to return multiple lookup values into one cell.
    So for example, I have part numbers that can be at different stock locations. ie


    Stock Locations (worksheet)
    Part Location
    X A10-Front
    Y A11-Front
    Z A12-Front
    X A13-Front
    Y A14-Front
    Z A15-Front
    X A16-Front
    Y A17-Front
    Z A15-Front


    I want to summarise the locations for each part number as below.
    Locations (worksheet)
    Part Locations
    X A10, A13, A16
    Y A11, A14, A17
    Z A12, A15


    Note all the locations are in one cell and the returned text has been trimmed to remove the text "-Front". Also I dont want duplicates to appear as in Z A15-Front which appears twice on the list.
    I require a macro that will run from another worksheet as the stock location spreadsheet will be a fresh download weekly.


    My VBA is improving slowly but this is way beyond me. Any help is greatly appreciated.

  • Re: Multiple lookup values returned into one cell


    Hi


    I have managed to find a function which pretty much does what I want. However the function only runs within the "multi stock location" spreadsheet in conjunction with the manual input of the getmacs formula.
    I need to have this function embedded in a sub routine macro in another spreadsheet.

  • Re: Multiple lookup values returned into one cell


    Hi..


    I modified your Function so it removes the hyphen and the characters to the right of the hyphen..


    Am trying now to turn it into a Sub.. hitting a bit of a brain block on that one though atm..


  • Re: Multiple lookup values returned into one cell


    Hi..


    This seems to work.. Click the Button in the attached Workbook..


    Remove (or comment out) your Getmacs Function or it will try to call it when this sub is run...


    I probably should have just changed the Getmacs variable to another name.. in hindsight..


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!