+ Reply to Thread
Results 1 to 15 of 15

Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

  1. #1
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    The code I have that works is as follows:

    Please Login or Register  to view this content.
    However, as this is repeated in a 15 by 89 (subject to change, can be as many as 50,000) list of data, it takes a long time to calculate the fields.

    I am trying to change it so instead of looking at the whole column $Q:$Q, it will look at "$Q1:Q" & AZ1

    AZ1 has the formula
    Please Login or Register  to view this content.
    , in this case, it will return 89.

    Now, I can hard code in every instance "$Q1:Q89" and perform a find/replace when appending more records, but I would like this to be dynamic (to reduce the chance of errors occurring should a reference be missed)

    Any ideas on how to do this?

  2. #2
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Have you looked into creating named ranges that utilize the cells with data in a given row/column, and referencing those in your INDEX/MATCH instead?
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

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

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Use dynamic named range to set up lookup table/data or just have it converted to Excel table and use structured reference.

    Alternately leverage other tools in Excel (such as PowerQuery etc).

    If you need help in setting up, upload sample file that's representative of your data structure.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Quote Originally Posted by mcmahobt View Post
    Have you looked into creating named ranges that utilize the cells with data in a given row/column, and referencing those in your INDEX/MATCH instead?
    Sorry, I forgot something rather fundamental as to why I haven't done this as a named range. The column can change based on the another value.
    In once instance, it can be column Q, in another it can be R.


    Quote Originally Posted by CK76 View Post
    Use dynamic named range to set up lookup table/data or just have it converted to Excel table and use structured reference.

    Alternately leverage other tools in Excel (such as PowerQuery etc).

    If you need help in setting up, upload sample file that's representative of your data structure.

    Unfortunately this site won't allow me to upload the test file I am building, as that would be easier

    Yes, I know how to search, I am asking directly for help to see if there is something I have missed.
    Last edited by OTWarrior; 05-11-2017 at 09:16 AM.

  6. #6
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Quote Originally Posted by OTWarrior View Post
    Unfortunately this site won't allow me to upload the test file I am building, as that would be easier
    Is the site providing an error code/reason for this? The site does allow for workbook uploads. At the bottom of the page > Go Advanced > Manage Attachments

  7. #7
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    I click the attachment icon, a small line appears below but it doesn't bring up a browse dialog or similar

    no error code
    Last edited by OTWarrior; 05-11-2017 at 09:19 AM.

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

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Upload Icon isn't working currently. You'll need to hit "Go Advanced" and manage attachments there.

  9. #9
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Trying to do this now. Attached?
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Can you explain what each Filter column is actually trying to "filter" for within your Main spreadsheet?

  11. #11
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Your formulas in column Y are heavily and unnecessarily volatile. The formula in Y7 can be replaced by the simpler, non-volatile:

    =INDEX(INDEX('Staff data'!$1:$1048576,,MATCH($B$4,DDlist,0)),MATCH($X:$X,'Staff data'!$Q:$Q,0))

    Similarly for the formulas in column Z.

    However, it is not this set of formulas which is causing you problems with calculation time, but rather those in S16:S28 and V14:V22. The formula in S16, for example, contains the portion:

    COUNTIF(S15:S15,INDIRECT("'Staff data'!"&H$4&":"&H$4))

    which resolves to:

    COUNTIF(S15:S15,'Staff data'!C:C)

    and, since you are wrapping this in an external, array-coercing INDEX function, you are effectively asking the formula to perform a count for all entries in column C of the Staff data sheet, an astonishing number of cells to be processed by a single formula.

    I suggest you either make your ranges dynamic, as have suggested others. Failing that, you can always choose a 'better' upper bound than row 1,048,576; even 10,000 (which surely should be sufficient in your case?) would reduce the processing time by a factor of 100.

    On top of that, I suggest you study the non-volatile formula I gave you and make similar amendments to all of your INDIRECT/ADDRESS constructions, all of which are volatile and none of which are necessary.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  12. #12
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Quote Originally Posted by XOR LX View Post
    Your formulas in column Y are heavily and unnecessarily volatile. The formula in Y7 can be replaced by the simpler, non-volatile:

    =INDEX(INDEX('Staff data'!$1:$1048576,,MATCH($B$4,DDlist,0)),MATCH($X:$X,'Staff data'!$Q:$Q,0))

    Similarly for the formulas in column Z.
    I changed these ones respectively and this improved the speed by quite a bit, thank you.

    Quote Originally Posted by XOR LX View Post
    However, it is not this set of formulas which is causing you problems with calculation time, but rather those in S16:S28 and V14:V22. The formula in S16, for example, contains the portion:

    COUNTIF(S15:S15,INDIRECT("'Staff data'!"&H$4&":"&H$4))

    which resolves to:

    COUNTIF(S15:S15,'Staff data'!C:C)
    Unfortunately, cell H4 is what I am using to make this dynamic. H4 will change when user chooses an item from D4. This cannot be static.
    How else can this be changed to be dynamic within S16:S28 and V14:V22?

  13. #13
    Registered User
    Join Date
    05-05-2017
    Location
    Colchester, England
    MS-Off Ver
    Office 365 / 2016
    Posts
    7

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Quote Originally Posted by mcmahobt View Post
    Can you explain what each Filter column is actually trying to "filter" for within your Main spreadsheet?
    B4 is to choose a selection within the top row within the other worksheet, this is then used in column V to pull the unique values (of which I am trying to work out how to put them in alphabetical order, but that's a headache for another time), populating the data validation list in B4

  14. #14
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    Quote Originally Posted by OTWarrior View Post
    Unfortunately, cell H4 is what I am using to make this dynamic. H4 will change when user chooses an item from D4. This cannot be static.
    You don't understand. I appreciate that you want the choice of column to be dynamic, but do you realise that you're forcing Excel to calculate every single cell (all 1,048,576 of them) within that dynamically-chosen column? That's what's causing your lag - try deleting those 22 formulas temporarily and see the huge difference in calculation time for your workbook.

    Regards

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

    Re: Trying to improve speed of Index match, want to lookup "A1:A" & lastrow

    @OTWarrior

    I'm not exactly sure what you are trying to do... but the parts I think understood has been replaced with non volatile formula.

    I'll need further explanation of what you are trying to accomplish.

    P.S. Personally for this type of set up I'd use PowerQuery to return table with dynamic parameter passed on from named range.
    Attached Files Attached Files

+ 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. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  2. Need help understanding "Index" and "Match"
    By joannelittell in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-29-2013, 03:08 PM
  3. [SOLVED] Multiple criteria lookup - First match :exact" and second match "Closest"
    By mweichorn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-16-2013, 12:14 PM
  4. Replies: 7
    Last Post: 04-11-2013, 12:46 AM
  5. Strings Variables in Range("A1").Formula = "=index/match" ?
    By nadnerb5 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-19-2012, 05:07 PM
  6. [SOLVED] Variable "sheet-name" and "range-name" wanted in INDEX/MATCH-function
    By Fiebuls in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2012, 04:09 PM
  7. Replies: 3
    Last Post: 02-16-2011, 02:55 PM
  8. Replies: 2
    Last Post: 07-02-2006, 05:50 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