Add Amounts Based on a Condition in Excel 2000 
You have a column filled with part numbers, and next to it a column
filled with the amounts of each part available in different regions. You
want to be able to enter a part number in a cell, and see the total amount
available in all regions in an adjacent cell. In the following example,
Cell E5 contains the formula:
=SUMIF(A2:A12,E4,C2:C12)
where A2:A12 is the Range of parts referenced; E4 is the
Criteria, or part number for which you want to find a total amount;
and C2:C12 is the Sum_range, or range of data that should be summed
when a matching part number is found on the same row.
You can also count cell entries based on a condition by using the
COUNTIF function. For more information on this and the SUMIF function,
type COUNTIF function or SUMIF function in the Office
Assistant or on the Answer Wizard tab in the Excel Help window, and
then click Search.
If you want Excel to generate a formula to sum specific data for you,
you can use an add-in program called the Conditional Sum Wizard. For more
information, type Conditional Sum Wizard in the Office Assistant or
on the Answer Wizard tab in the Excel Help window, and then click
Search.