Creating a formula that will SUM with 2 Variables

B

B Akers

I have been trying to figure out how to create a formula in Excel 2003 that
will sum only if 2 variables are met. An example would be if you had 5000
rows of data. Columns are NAME, AGE, CITY. Let's say I wanted to sum how
many people are in Seattle and are 25 can Excel do this?
 
M

Max

One way ..

Assuming City in col C, Age in col B
data from row2 to 5000

we could put in say E1:
=SUMPRODUCT(($C$2:$C$5000="Seattle")*($B$2:$B$5000=25))

Alternatively,
we could point to cells instead of hardcoding
so if we input in D1: Seattle, in D2: 25,
then in E1:
=SUMPRODUCT(($C$2:$C$5000=D1)*($B$2:$B$5000=D2))
 
Top