+ Reply to Thread
Results 1 to 11 of 11

Make model faster: convert formulas to text and then back to formulas

  1. #1
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Make model faster: convert formulas to text and then back to formulas

    Hi all,

    I am building a model which is becoming extremely slow, every update to the calculations takes c 30 seconds to compute.

    I've identified the problem and believe there could be a good solution to this by converting some formulas to text and then back to formulas again.

    Between the sheets "Start" and "End" there are sheets numbered 1-30 with a lot of calculations on each sheet. They are built exactly the same however - meaning if I would copy the entire sheet from sheet 1 and paste it to sheet 3 for example, the formulas would copy paste correctly onto sheet 3.

    Let's say I would only want the formulas for sheet 5 to work, and for all the other sheets numbered 1-30 (excl 5 of course) the values would be copy pasted to text values. By doing this the model works much faster and I can do changes that affect sheet 5 in isolation.
    When I'm done doing these changes to sheet 5 I want the formulas the be "revived" on the other sheets. If the macro could just copy paste the entire sheet formulas from sheet 5 onto all other sheets 1-30 (located between sheet "Start" and "End"), the model would be restored to it's proper functioning, albeit slower again.

    The point of this would be to "freeze" the numbered sheets I'm not interested in reviewing and making the model only recalculating the formulas on one sheet at a time (there needs to be a way of telling the macro which sheet to be isolated. They are named 1-30 accompanied by names. So only the first letter of each sheet name is a number from 1-30)

    Hopefully this makes sense and I hope any of you have a smart solution to this!

    Thanks a lot!

    /Lucas

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Make model faster: convert formulas to text and then back to formulas

    The Worksheet object has an EnableCalculation property that allows you to disable calculation on a per sheet basis. You can toggle that on and off in code rather than having to copy and paste formulas.
    Rory

  3. #3
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Make model faster: convert formulas to text and then back to formulas

    Thanks for your reply. That's great!

    I'm really new to coding, how do I practically implement that? And making sure I know which sheet to target?

    THanks

  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,419

    Re: Make model faster: convert formulas to text and then back to formulas

    You should maybe look at the design of the workbook and determine what it is that's making it so slow. Do you need 30 separate sheets, or could you consolidate the data into one and use filtering (albeit, you might need an extra column or two to identify the original location.

    Do you have lots of columns, lots of rows, complex formulae, array formulae? Do you sue full column references in your formulae? Do you use Volatile functions?

    See: http://www.decisionmodels.com/calcsecretsi.htm

    Excel’s Volatile Functions.

    Some of Excel’s functions are obviously volatile: RAND(), NOW(), TODAY()

    Others are less obviously volatile: OFFSET(), CELL(), INDIRECT(), INFO()

    Some are volatile in some versions of Excel but not in others: INDEX()became non-volatile in Excel 97.

    A number of functions that are documented by Microsoft as volatile do not actually seem to be volatile when tested:

    INDEX(), ROWS(), COLUMNS(), AREAS()

    and CELL("Filename") IS volatile although a MSKBN article says its not.

    One particular syntax of SUMIF is volatile in Excel 2002 and subsequent versions. This occurs when the size of the first range argument is not the same as the second (sum_range) argument.
    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


  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Make model faster: convert formulas to text and then back to formulas

    You could use something like this:

    Please Login or Register  to view this content.
    the first routine will turn off calculation for all sheets except the active one, and the second resets calculation for all sheets.

  6. #6
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Make model faster: convert formulas to text and then back to formulas

    Thanks Rorya.

    Only thing is I don't want all other sheets to not calculate, only the sheets between "Start" and "End" numbered 1-30 (apart from the sheet specifically requested to do the calculations).

    There is a summary sheet where inputs to the numbered sheets can be made, on to which I would prefer to have the option to choose for example Sheet 5 within that range to still be calculated, whereas the other ones to not be.

    Does that make sense?

    Thanks a lot for your input, very valued!

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Make model faster: convert formulas to text and then back to formulas

    So how do you want the code to determine the sheet to leave calculating, if it won't be the active sheet? Do you want a prompt, or to use a cell value, or something else?

  8. #8
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Make model faster: convert formulas to text and then back to formulas

    Let's say on the Summary sheet in cell F2 one could input any number from 1-30.

    If I would input 5 then all sheets apart from the 5th sheet between the sheets "Start" and "End" would have their calculations disabled (remember that the sheets are named 1. ExampleName 2. ExampleName 3. ExampleName etc so it has to find the correct numbered sheet by only looking at the first letter for each sheet).

    Thanks a lot for your help.

  9. #9
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Make model faster: convert formulas to text and then back to formulas

    Untested but something like this:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    01-16-2019
    Location
    London, England
    MS-Off Ver
    365 MSO 32-bit
    Posts
    11

    Re: Make model faster: convert formulas to text and then back to formulas

    You're a genius, works just like a charm, calc time from 30 s to 5 s!!!

    Many thanks for your help, this is great!

  11. #11
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Make model faster: convert formulas to text and then back to formulas

    Glad to help.

+ 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. Make excel workbooks with formulas run faster
    By MetteGaga in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-23-2017, 06:04 PM
  2. [SOLVED] Convert a group of formulas to array formulas at once
    By coach.32 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-16-2015, 02:21 AM
  3. need to convert text to formulas
    By jago in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-13-2015, 02:40 PM
  4. vba code to convert formulas into text.
    By winmaxservices1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-05-2015, 04:31 AM
  5. Replies: 0
    Last Post: 02-08-2012, 02:38 PM
  6. Convert formulas in text into formulas
    By Tau in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 12-13-2007, 08:31 AM
  7. [SOLVED] How do I convert cells containing formulas to text (value returned
    By Kim in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-28-2005, 05:06 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