+ Reply to Thread
Results 1 to 8 of 8

Extremely slow INDIRECT() routine. Fix?

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Extremely slow INDIRECT() routine. Fix?

    Hey guys

    In my main.xlsx I have the sheet Sheet2 and the cell
    B2, containing the reference string [A.xlsx]Sheet1!$A$1:$GR$3000.

    As you can see, it is referencing to 600'000 cells in another workbook.

    Now, in another worksheet of the main workbook I have following formula:

    =IF(ISERROR(INDIRECT(Sheet2!$B$2));"";IF(INDIRECT(Sheet2!$B$2)="";"";INDIRECT(Sheet2!$B$2)))

    The 1. IF statement makes sure no error appears
    The 2. IF statement makes sure no zeros are written where there is no data

    My problem:
    The above function is triggered 2x600'000 times which makes the whoe workbook extremely slow.

    My question:
    Is there a faster way (under fast I mean something <1 second

    Because right now, it is impossible to work with it and I tried to cut the range into the minimum of 2000x150(= ET) but it is still very slow.

    Thank you guys
    Kind regards
    Last edited by nivoe; 11-09-2012 at 09:02 AM. Reason: wrong arguments

  2. #2
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Extremely slow INDIRECT() routine. Fix?

    Try using IFERROR. It will only need to check INDIRECT once, so will work much faster.

    =IFERROR(INDIRECT(Sheet2!$B$2),"")

    Don't forget to click the little star to the left of this post if you feel I helped!
    Taming the Excel dragon... www.TheExcelphile.com

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Extremely slow INDIRECT() routine. Fix?

    It did improve the speed, but

    - the zeros are now appearing where there is no data in the source workbook
    any workaround without calling indirect twice?

    I would love to have a solution without the indirect function (but I am too rookie to know how).
    From my point of view, I think it is still a very slow function for such data ranges

    Any ideas?
    Thank you so far

  4. #4
    Forum Contributor
    Join Date
    11-05-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    229

    Re: Extremely slow INDIRECT() routine. Fix?

    The best solution I can come up with is to use conditional formatting to not display the zeros. There is no real substitute for Indirect.
    You could try a VBA solution for your problem, but I won't be able to help you with that...

  5. #5
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Extremely slow INDIRECT() routine. Fix?

    Hi - Can you upload a sample workbook to see if an alternate to indirect could be used.

    for your second part of the query, select the data range and custom format (under format cells) them as

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This will display any cells with 0 as blank

    Note that the above format is only for numbers, if there are any percentages etc, you will have to modify this accordingly.
    If solved kindly remember to mark Thread as solved.
    Click the small star icon at the bottom left of my post if this was useful.

  6. #6
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Extremely slow INDIRECT() routine. Fix?

    Ok, I attached the files.

    Be aware that my sample files are smaller than the big ones, but you can already experience the slow down.

    I had to make the range in Main.xls only to 1000 rows to keep the size under 1 mb.

    I'd love to have a solution that really gets the cells of A.xlsx into that one sheet so I can keep conditional formatting easily.

    Thank you!!!

    AND, empty data in A.xlsx must equal to "", because if I keep the zeros I cannot continue to work with the data as some entries are binary (0,1).
    Attached Files Attached Files
    Last edited by nivoe; 11-09-2012 at 10:11 AM.

  7. #7
    Registered User
    Join Date
    10-11-2012
    Location
    switzerland
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Extremely slow INDIRECT() routine. Fix?

    To everyone

    Thanks for the input so far, but I am trying it with VBA because I don't see an end for this

  8. #8
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: Extremely slow INDIRECT() routine. Fix?

    Does it help if you move / produce the output in the same workbook i.e. A.xls? Is it anybetter then (in the sample it works ok).

    Since we are using Rand function in each cell it would take some time atleast to update all the values in your range, so that explains the slowness here.

    For the second bit, I just selected the entire sheet 1 in Main.xls workbook and applied the above mentioned cell formats [0;-0;;@] and this takes care of your second bit.

    Hope this helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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