+ Reply to Thread
Results 1 to 4 of 4

nested iferror index match for 10k rows

Hybrid View

  1. #1
    Registered User
    Join Date
    01-02-2014
    Location
    Tri-State Area, USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Red face nested iferror index match for 10k rows

    hello, i am trying to insert a nested iferror/index/match formula that basically searches for a value, if its missing checks for the value in the next list, and so on

    the problem is there are about 10,000 rows and even with the below code the macro is painfully slow (longer than 20 mins). Additionally i would like to use slight variations of this formula in a few more columns, which makes it even more daunting.

    Please note the number of rows will be dynamic so the formula must be inserted in every row until row is blank (which it currently does as written)

    Can someone kindly review the below code and let me know I could accomplish this faster?

    Thanks!!!!


    Sub code1()
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    Application.Calculation = xlCalculationManual
    
    
        Dim ws As Worksheet
        Dim lRow As Long
    
        Set ws = ThisWorkbook.Sheets("Sheet1")
    
        With ws
            lRow = .Range("A" & .Rows.Count).End(xlUp).Row
    
            .Range("B3:B" & lRow).Formula = "=IFERROR(INDEX(LEFT('list1'!C[7],2),MATCH('Sheet1'!RC[-1],'list1'!C[-1],0)),IFERROR(INDEX(LEFT('list1'!C[7],2),MATCH('Sheet1'!RC[-1],'list1'!C,0)),IFERROR(INDEX(LEFT('list1'!C[7],2),MATCH('Sheet1'!RC[-1],'list1'!C[2],0)),IFERROR(INDEX(LEFT('list1'!C[7],2),MATCH('Sheet1'!RC[-1],'list1'!C[4],0)),""No matches""))))"
            .Range("B3:B" & lRow).Value = .Range("B3:B" & lRow).Value
        End With
        
        
        
     
    Application.Calculation = xlCalculationAutomatic
    Application.EnableEvents = True
       Application.ScreenUpdating = True
        
        End Sub

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: nested iferror index match for 10k rows

    try using the Range.find()

  3. #3
    Registered User
    Join Date
    01-02-2014
    Location
    Tri-State Area, USA
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: nested iferror index match for 10k rows

    thank all of you for the suggestions, how would I implement Range.find() in my existing code?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,606

    Re: nested iferror index match for 10k rows

    See the attached link and sample workbook:

    http://www.excelforum.com/excel-form...-in-excel.html

    The original thread returns values, using an index/match formula, across several rows and columns.

    The formula provided is only interested in if the lookup value exists anywhere and, if it does, what row is it on, so it can index another column.

    I have added two formulae, based on the original formula to return just the row and the column.

    B2: Value
    Formula: copy to clipboard
    =IF(SUMPRODUCT(--($D$2:$P$15=A2))=0,"",INDEX($C$2:$C$15,SUMPRODUCT(($D$2:$P$15=A2)*(ROW($D$2:$P$15)-MIN(ROW($D$2:$P$15))+1))))

    Q2: Row
    Formula: copy to clipboard
    =IF(SUMPRODUCT(($D$2:$P$15=A2)*(ROW($D$2:$P$15)-MIN(ROW($D$2:$P$15))+1)),
    SUMPRODUCT(($D$2:$P$15=A2)*(ROW($D$2:$P$15)-MIN(ROW($D$2:$P$15))+1))+1,"")

    R2: Column
    Formula: copy to clipboard
    =IFERROR(MATCH(A15,INDIRECT(VALUE(SUMPRODUCT(($D$2:$P$15=A15)*(ROW($D$2:$P$15)-MIN(ROW($D$2:$P$15))+1)))+1 &":"&
    VALUE(SUMPRODUCT(($D$2:$P$15=A15)*(ROW($D$2:$P$15)-MIN(ROW($D$2:$P$15))+1)))+1),0),"")



    See the attached workbook.

    At this point, it has nothing to do with VBA. But it might be possible to adapt these formulae to meet your needs rather than the nested IF statements that you currently have.

    If you post a sample workbook, we might be able to make that adaptation.

    Regards, TMS
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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] Problem with the getting all locations sales using iferror, index, match
    By brandedadnan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-10-2013, 03:14 AM
  2. Adding IFERROR to INDEX MATCH
    By brad999 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-06-2013, 04:18 AM
  3. [SOLVED] IFERROR+INDEX+MATCH Formula is not returning the correct value
    By bxk006 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-16-2013, 09:50 AM
  4. Wrong result displaying using IFERROR-INDEX-MATCH-ROW Formula
    By paradise2sr in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-16-2013, 01:03 PM
  5. Looking for better formula of iferror, index and match
    By DavidRoger in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-23-2012, 07:50 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