Array Formulae |

| Importance of Speed | Faster Calculations | Microsoft's Advice | Bottlenecks/Size |
| Lookups | Dynamic Ranges | Totalling | Generating Workbooks |
| Multi-Level Calculations | Array Formulae | SUMIF Example | Worksheet Links |
Array FormulaeArray formulae are one of Excels most powerful features, although not always the easiest to use. Look at Bob Umlas's excellent paper at http://www.emailoffice.com/excel/arrays-bobumlas.html for many examples of Array formulae, and also Chip Pearson's page at http://www.cpearson.com/excel/array.htm . Single-cell array formulae are evaluated multiple times, depending
on the number of cells referred to in the formula. This can take significant
time, and may or may not be faster than the alternatives. Minimise the Number of Array Operations
Array formulae SUM with multiple conditionsOne frequent use of Array formulae is to do a sum with multiple conditions. This relatively easy to do, particularily if you use Excel's Conditional Sum Wizard, but often very slow. Usually there are alternative ways of getting the same result, but much faster. Two good methods of speeding up multiple condition SUMs are:
See SUMIF example for a worked example. The downloadable FastExcel Sample Problem also has an example which shows the method and the considerable time saving which is often achievable. Using SUMPRODUCT for multiple condition array formulae.There are some advantages to using SUMPRODUCT rather than SUM array formulae:
You can use SUMPRODUCT for multiple condition array formulae as follows: SUMPRODUCT(--(Condition1),--(Condition2),RangetoSum) where Condition1 & 2 are conditional expressions such as $A$1:$A$10000<=$Z4. Because conditional expresssions return True or False rather than numbers they need to be coerced to numbers inside the SUMPRODUCT function. You can do this using two minus signs (--) or by adding 0 (+0) or by multiplying by 1 (*1). Using -- is very slightly faster than +0 or *1. Bug in Excel 2007 SP2: If you use the 2 minus signs
(--) syntax in an array formula or SUMPRODUCT formula with a direct
reference to a volatile function in Excel 2007 SP2 the formula does
not recalculate when the vloatile function referred to recalculates.
(this works correctly in all other Excel versions). For Example: Note that the size and shape of the ranges or arrays used in the conditional expressions and range to sum must be the same, and cannot contain entire columns. You can also directly multiply the terms inside SUMPRODUCT rather than separate them by commas: SUMPRODUCT((Condition1)*(Condition2)*RangetoSum) But this is usually slightly slower than using the comma syntax,
and gives an error if the range to sum contains a text value. Using SUMPRODUCT to multiply and add ranges and arrays.In cases like weighted average calculations where you need to multiply a range of numbers by another range of numbers and sum the results using the comma syntax for SUMPRODUCT can be 20-25% faster than an array entered SUM: {=SUM($D$2:$D$10301*$E$2:$E$10301)} =SUMPRODUCT($D$2:$D$10301*$E$2:$E$10301) =SUMPRODUCT($D$2:$D$10301,$E$2:$E$10301) These three formulae all produce the same result, but the third formula using the comma syntax for SUMPRODUCT only takes about 77% of the time to calculate that the other two formulae need. Use DSUM instead of multiple condition array formulae.If you only have a few array formulae sums with multiple conditions you may be able to use DSUM instead. DSUM is significantly faster than equivalent array formulae. The disadvantage of DSUM is that the criteria have to be in a separate range, which makes it impractical to use and maintain in many circumstances. Use FastExcel AVLOOKUPS.You can use the FastExcel Version 2 AVLOOKUPS function inside a SUM function to return multiple rows and SUM them. If you are doing multiple conditional sums, particularly on sorted data, AVLOOKUPS can be significantly faster than array formulae. Array and Function Calculation BottlenecksExcels calculation engine is optimised to exploit array formulae and functions that reference ranges. However some unusual arrangements of these formulae and functions can sometimes, but not always, cause significantly increased calculation time. If you find a calculation bottleneck involving array-formulae and range functions look for:
Advantages and Disadvantages of Array FormulaePlus points of Array Formulae:
Minus points of Array Formulae:
|
||||||||
|
||||||||
![]() |
||||||||