+ Reply to Thread
Results 1 to 3 of 3

Change lookup formula to VB

  1. #1
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Change lookup formula to VB

    I am currently using the following lookup formula:
    =IFERROR(LOOKUP(2,1/(EquipmentData!$B$3:$B$1048576=$G6),EquipmentData!$C$3:$C$1048576)&"","")

    However I would like to change this action to take place using VB in the worksheet change event code. The reason being is because this formula runs extremely slowly (because I need it to find a match starting from the lowest rows, not from the top), and sometimes the formula in the cell gets accidentally erased.

    I currently already have the following code in the change event for that sheet which it would need to work alongside:
    Please Login or Register  to view this content.
    The sheet I'm working on is called ReturnData, and the formula is in the F column (from 6 down).
    I have attached my workbook.
    Thank you for you time.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Change lookup formula to VB

    Please Login or Register  to view this content.
    Where A1 is the cell you want the formula to apply to.

  3. #3
    Forum Contributor
    Join Date
    09-16-2013
    Location
    Los Angeles, USA
    MS-Off Ver
    Excel 2011
    Posts
    620

    Re: Change lookup formula to VB

    That didn't seem to do anything for me. The column I want the formula in is F (from rows 6 down). I tried changing the formula to the following but it didn't work either:
    Range("$F6").formula = "=IFERROR(LOOKUP(2,1/(EquipmentData!$B$3:$B$1048576=$G6),EquipmentData!$C$3:$C$1048576)&"""","""")"
    Range("$F6").value = Range("$F6").value

    Will this work quicker that just having the formula in the cells? Because currently this formula almost grinds this workbook to a holt. Im assuming because its actually looking at every row in EquipmentData from the bottom of the sheet up. Can this not be done from scratch with some VB code so it just starts the search from the last record?
    If it helps I already have two dynamic ranges for that sheet already, one called EquipmentList which lists every record in C, and one called SerialNumbs which lists every record in B.

+ 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. Find/Replace macro with lookup table of change from to change to
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-19-2013, 07:37 AM
  2. LOOKUP formula change
    By donyc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-05-2012, 07:26 PM
  3. Replies: 5
    Last Post: 02-24-2011, 11:26 AM
  4. [SOLVED] Lookup and Change
    By rollover99 via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2005, 09:17 PM
  5. Replies: 3
    Last Post: 10-10-2005, 01:05 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