You have to use an array formula. Type the following into
the cell that should display the results:
=SUM(IF(A2:A5="ProductA",1,0)*IF(C2:C5="shipped",1,0)
*B2:B5)
Instead of pressing ENTER, press SHIFT-CONTROL-ENTER to
enter the formula as an array formula. You should see a
pair of curly braces {} around the formula if you enter
it correctly. The example above assumes your actual data
resides in cells A2:C5.
This formula creates three arrays in memory. The
first "If" clause creates an array of ones and zeroes (a
1 if the entry equals ProductA, a zero if it doesn't.)
The second "If" clause creates a second array of ones and
zeroes, entering a 1 if the value is shipped, a zero if
not shipped. The portion "B2:B5" creates a third array,
consisting of the values in column B of you data. The
corresponding elements of each array are then multiplied
by each other, and the results of the multiplication are
added by the Sum function.
So, for your data in the first row, the first "if"
creates a value of 1 (because it equals ProductA), the
second "if" creates a value of 1 (because it has
shipped), and the "B2:B5 portion creates a value of 10. 1
* 1* 10=10, of course.
All the remaining rows of data will generate a zero in
one of the "if" clauses, because either the product is
not ProductA, or because it is ProductA but hasn't
shipped.
You may think you could use the AND function in the
formula, instead of multiplication. However, the AND
function doesn't give the expected results. Also, in
the "if" functions, you don't really have to include the
zero as the value if the comparison statement is false.
Excel will default to zero. Finally, I have been reading
a book titled Microsoft Excel 2000 formulas, by John
Walkenbach. it has some good examples of array fromulas,
if you're interested. The ISBN for it is 0-7645-4609-0