+ Reply to Thread
Results 1 to 6 of 6

VBA Code Needed to Replace Lookup Formula

  1. #1
    Registered User
    Join Date
    08-11-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    78

    VBA Code Needed to Replace Lookup Formula

    Hello Gurus of Excel,

    I'm currently in a bind where I'm looking to replace a lookup formula with a vba code (hopefully). I was looking to find a method to convert this formula ('=LOOKUP(2,1/(C7=Data!$A$2:$A$200)/(D7=Data!$B$2:$B$200),Data!$C$2:$C$200)) into VBA code. The goal would be to be able to have to lookup table work with the VBA code and then press a button to get the results from the data being that I will have thousands of rows of data using a VBA code would help quicken the process. All my reference information is on the "Data" tab (this will be updated from time to time) and the sample tab is where the lookup and return results will happen. I provided a sample within this post.

    Thank you for any help that be provided...
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA Code Needed to Replace Lookup Formula

    Something like below?
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    08-11-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    78

    Re: VBA Code Needed to Replace Lookup Formula

    Hi CK76,

    Thanks for taking the time to look at this. Quick question with the VBA you provided will this continually update if I add more data to the "Data" tab?

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA Code Needed to Replace Lookup Formula

    You just have to run the code again. It will grab range dynamically.

    Or tie it to Worksheet_Change Event. Really would depend on your use case.

  5. #5
    Registered User
    Join Date
    08-11-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    78

    Re: VBA Code Needed to Replace Lookup Formula

    Thanks CK76! This code works perfectly. Thank you again for taking the time to help!

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: VBA Code Needed to Replace Lookup Formula

    You are welcome and thanks for the rep

+ 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. A mod needed in Find and Replace -code
    By koopalola in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2017, 09:45 AM
  2. Find and Replace when needed Code
    By ulothar in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-09-2017, 08:09 PM
  3. [SOLVED] VBA code 3 way lookup replace the old value by new value from masterdata
    By MicroTees in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2015, 06:01 AM
  4. [SOLVED] Formula to find and replace where needed
    By maymano in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-07-2013, 02:09 PM
  5. Help needed to do a lookup and replace
    By wei82 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2013, 09:20 PM
  6. Lookup, Find and Replace macro needed
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-11-2011, 11:41 AM
  7. Replies: 0
    Last Post: 04-07-2009, 11:43 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