Monday, February 27, 2006
SUMPRODUCT array formulas in Excel
I have written about these before as a way of summing data from tables using multiple selection criteria.
SUM(range) just sums a range of cells.
SUMIF(criteria range, criteria, sum range) sums data in one range based on results in a parallel range.
SUMPRODUCT((array1="criteria")*(array2="criteria")*(array3)) entered with CTRL SHIFT ENTER returns the sum of the data in the array3 where the crietria in arrays one and two are met. This can be expanded a lot.
Chris Pearson (as always) is one of the definitive sources for array forumlas.
Bob Phillips from the UK has written a very detailed page that very carefully explains how this works and how to use it with some practical examples.
Reading them both will give you some very valuable insights into how array formulas work and how to utilise them in your spreadsheets.
Some additional tips.
- Arrays must be the same dimensions.
- Having invalid information (eg text) in the array can be ignored using the double unary operator like so SUMPRODUCT(--(array1="criteria")*(array2="criteria")*(array3)).
- Arrays cannot be a whole column, but can be a whole row.
Finally, if anybody knows anything about how Office 12 will treat these types of formulas I am sure the Excel community would be interested to know.