+ Reply to Thread
Results 1 to 9 of 9

Sort code in sheetchange very slow - any improvements possible?

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Sort code in sheetchange very slow - any improvements possible?

    As the title suggests, I have made some changes to my worksheets that are sorted (mainly data validation enhancements) and my sort coding below is taking forever to work, often a minute or two for every sheet change event. Any suggestions as to where I can trim some seconds of the time?

    Please Login or Register  to view this content.
    Last edited by nickmax1; 06-04-2014 at 10:58 AM. Reason: found error

  2. #2
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sort code in sheetchange very slow - any improvements possible?

    I figured that this code that is present in the above is slowing it down to a crawl - but it is needed, any way this can be improved?

    Please Login or Register  to view this content.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Sort code in sheetchange very slow - any improvements possible?

    What formulas are in L17:P17?
    Remember what the dormouse said
    Feed your head

  4. #4
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sort code in sheetchange very slow - any improvements possible?

    L17 =IF(OR($F17="New",$A17=""),"",IFERROR(INDEX('P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$AL$3:$AL$8000,MATCH($AI17,'P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$A$3:$A$8000,0)),""))
    M17 =IF(OR($F17="New",$A17=""),"",IFERROR(INDEX('P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$AG$3:$AG$8000,MATCH($AI17,'P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$A$3:$A$8000,0)),""))
    N17=IF(OR($F17="New",$A17=""),"",IFERROR(INDEX('P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$AI$3:$AI$8000,MATCH($AI17,'P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$A$3:$A$8000,0)),""))
    O17= text
    P17=IF(I17="","",IF(OR(I17="Quoted",I17="Bound",I17="WIP",I17="Firm"),"Live","Dead"))

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Sort code in sheetchange very slow - any improvements possible?

    It's pretty inefficient to do the same MATCH 3 times. You'd be better off doing that in a separate column and then using that value directly in the INDEX formulas. It should improve the speed.

  6. #6
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sort code in sheetchange very slow - any improvements possible?

    romperstomper
    thanks for your input - cant seem to change the match formulas now they are pretty ingrained in the spreadsheet. I removed the troublesome code in its entirety and placed it in a seperate module to run ad hoc and its all pretty quick now.

    EDIT: Just so you know the match formulas are very similar, but not the same...
    Last edited by nickmax1; 06-05-2014 at 06:08 AM.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Sort code in sheetchange very slow - any improvements possible?

    This part:
    MATCH($AI17,'P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$A$3:$A$8000,0)

    appears to be the same in all three formulas, unless I'm missing something?

  8. #8
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sort code in sheetchange very slow - any improvements possible?

    you are quite right - but thats beyond my skillset!
    If I place the MATCH($AI17,'P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$A$3:$A$8000,0) part in a seperate colomn (AJ17 lets say) that works, but then if I change my original formula to this:

    =IF(OR($F17="New",$A17=""),"",IFERROR(INDEX('P:\Departments Online\Property\Activity\[Sublog.xlsx]Page1_1'!$AL$3:$AL$8000,MATCH($AJ17,0)),""))

    i get a blank result instead of an expected value.

  9. #9
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Sort code in sheetchange very slow - any improvements possible?

    ah figured it out...
    =IF(OR($F19="New",$A19=""),"",IFERROR(INDEX([Sublog.xlsx]Page1_1!$AI$3:$AI$8000,AJ19),""))

+ 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] Vba code makes workboos slow. Any alternate code ??
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-23-2014, 04:30 AM
  2. [SOLVED] Auto sort two seperate ranges in a sheetchange event
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2013, 07:40 AM
  3. [SOLVED] Slow bubble sort
    By Oppressed1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-03-2012, 07:33 PM
  4. SheetChange Event
    By solidsnake5698 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2007, 02:01 PM
  5. [SOLVED] sheetchange
    By masterphilch in forum Excel General
    Replies: 2
    Last Post: 10-29-2005, 05: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