+ Reply to Thread
Results 1 to 9 of 9

VBA Macro for Complex VLookup table.

  1. #1
    Registered User
    Join Date
    03-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    VBA Macro for Complex VLookup table.

    Hi,

    I am looking for a macro perform like a vlookup. The table has multiple instances of a number string (with dashes or can contain letters ex. 23764-122, or 30007647, or 311-2 or 12243-123A) which can be active or discontinued at numerous different sites. Vlookup falls short and only returns the first instance and not the other sites which are using the value looked up. I would like it to say if this is Active or Discontinued and then which sites use it x,y,z. Can anyone help!?

    Thanks!
    Rowdy

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Macro for Complex VLookup table.

    Look at Range.Find and .Findnext. There is a pretty good example/explanation here.

    If you need more help thn that, please post an example worksheet showing want you want to happen.

  3. #3
    Registered User
    Join Date
    03-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA Macro for Complex VLookup table.

    I have included an example file.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Macro for Complex VLookup table.

    Sorry, I still don't understand what you want. Are you trying to loop through all the values in column A, find all the equivalent values in column G, then append H and I to B and C for that found value?

    If so, I don't understand columns B and C. Rows 8 and 9 look to be identical in column A, but have different B and C values and i don't understand why H11, H17, H24 and H12 are the referenced cells

  5. #5
    Registered User
    Join Date
    03-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA Macro for Complex VLookup table.

    Yes exactly what you said. Loop through all the values in column A, find ALL instances of that value in column G, and return the values in H and I in columns B and C. (None of those values in the example are correct, just did it myself as a fast example of what/how I want it to look like). Yes row 8 and 9 should indeed show the same values if they are exactly the same.

    I want it to correspond like take row 15 for example and lets say it appears 3 times in column G used at 3 different sites and different statuses.
    DEF - Discontinued
    New york - Active
    Los Angeles - Discontinued

    Combine these values the way they correspond in a readable fashion. Like separated by commas and spaces. Have the same order correspond like:
    DEF, New york, Los Angeles
    || || ||
    Discontinued, Active, Discontinued

    Column B Column C
    DEF, New york, Los Angeles Discontinued, Active, Discontinued
    1 2 3 1 2 3 (Just so it follows a flow - Like you read the 2nd Active and you will know it corresponds to New york.)

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Macro for Complex VLookup table.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA Macro for Complex VLookup table.

    You're THE BEST!!!!!!

    Thank you so much!!!!!!!

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: VBA Macro for Complex VLookup table.

    Glad to help. Please mark this thread as SOLVED, and I appreciate the reputation point.

  9. #9
    Registered User
    Join Date
    03-23-2015
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA Macro for Complex VLookup table.

    Done and done!

+ 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. complex macro needed for pivot table
    By Exceler54 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-08-2014, 01:18 PM
  2. Replies: 7
    Last Post: 12-10-2013, 05:21 PM
  3. [SOLVED] Complex vlookup with VBA macro
    By Deefty in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-27-2012, 04:46 PM
  4. Complex Vlookup/ VBA function or Macro Needed For "if contains text then vlookup"
    By alfykunable in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-09-2012, 03:48 AM
  5. Complex Vlookup Table
    By maacmaac in forum Excel General
    Replies: 3
    Last Post: 01-10-2006, 07:15 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