The -- coerces the conditional statement within the parenthases into a 1 or a 0. By doing this, it creates an array of 1s and 0s. This is useful in SUMPRODUCT because it takes each item in the arrays and multiplies them together, then adds them.
Lets take this data for example:
Excel Workbook |
---|
|
---|
| A | B |
---|
1 | foo | 1 |
---|
2 | stuff | 2 |
---|
3 | text | 4 |
---|
4 | here | 5 |
---|
5 | | 2 |
---|
6 | jack | |
---|
7 | | 9 |
---|
8 | snacks | 3 |
---|
|
---|
Excel 2003
When we use =SUMPRODUCT(--(A1:A8<>""),B1:B8), the -- makes sumproduct instead look at it in this fashion:
Excel Workbook |
---|
|
---|
| A | B |
---|
1 | 1 | 1 |
---|
2 | 1 | 2 |
---|
3 | 1 | 4 |
---|
4 | 1 | 5 |
---|
5 | 0 | 2 |
---|
6 | 1 | |
---|
7 | 0 | 9 |
---|
8 | 1 | 3 |
---|
|
---|
Excel 2003
Then, following the SUMPRODUCT logic, A1*B1+A2*B2+A3*B3+etc... it performs the following:
(1*1)+(1*2)+(1*4)+(1*5)+(0*2)+(1*0)+(0*9)+(1*3) = 15
This can also be done on more than two dimensions, which makes it useful for doing a multi-conditional SUMIF or even used just to simply count over multiple conditions.
Hope that helps! If you would like any further explanation or more examples, lemme know!