Improving calculation times

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
I've got a big forecast model, which takes about 5 secs to calculate.

There's a lot of formulae that do SUMIFS with 4-5 parameters and I want to make it more visible what it's doing so other people can use it.

is there much difference in referencing the ranges directly, or using dynamic formulae? Is the named range calculated every time it's referenced or does Excel cache the resulting range the first time?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Possibly is

SUMIFS(Sales,Rep,"jon")

resource deplating than

SUMIFS(A:A,B:B,"jon")

where Sales and Rep are dynamic named ranges.
 
Upvote 0
I would think the time to calculate is more impacted by the function and number of functions you are waiting to recalculate.
I think a Pivot Table would recalculate faster, but you get into the ying-yang between that speed and having to refresh the Pivot Table.

For the "ranges" I would prefer to use Table Fields. That provides the dynamic nature without having to call the entire Column. Any form of Named Range will help "other people" see what's going on. Same thing by using Slicers for Pivot Tables.
 
Upvote 0
A pivot table is not an option for various reasons. Ditto tables, I've got as many tables in as I can but the mofo calculation sheet has some reasonably complex formulae in.

I'm doing 2 versions, one with a 'compact' calculation sheet with about 3000 cells with complex calculations, and another with the computation broken out into 7 individual sheets with 1 calculation split across 2,000 rows. My gut feel is the complex one will be faster as the calculation tree will be wider but shorter, plus the split calculation version has an awful lot of rows with 0 as the result of the calculation.

What I'm trying to understand, is if I use a dynamic range say 3000 times, is it recalculated every time it's referenced or is the calculation tree intelligent enough to recognise it's the same range and only calculate it once. If the calc tree is built using pointers there's a good chance it's the latter if the programmers at MS were competent.
 
Upvote 0
You haven't stated exactly what formula you are using to create your dynamic used ranges.
 
Upvote 0
An example is
Code:
=OFFSET($A$1,1,0,COUNTA($A$2:$A$50),1)
 
Upvote 0
An example is
Code:
=OFFSET($A$1,1,0,COUNTA($A$2:$A$50),1)

This can be re-written...

Either as

$A$2:INDEX($A$2:$A$50,MATCH(9.99999999999999E+307,$A$2:$A$50)

for a numeric range;

Or as

$A$2:INDEX($A$2:$A$50,MATCH(REPT("z",255),$A$2:$A$50)

for a text range.

Or as

$A$2:INDEX($A$2:$A$50,COUNTA($A$2:$A$50))

if you don't have in-between empty cells.
 
Upvote 0
Thanks Aladin, I'll replace with the last option.
 
Upvote 0
Thanks Aladin, I'll replace with the last option.

You are welcome. COUNTA looks at every cell, something that takes time. The MATCH in the first two options do their job in a very few steps, thus very fast and they are not affected by empty cells or error values.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top