Question : How to write an excel =sumif formula with multiple conditions

I am using a SUMIF formula to calculate a figure based on a set of criteria from another worsheet.  Essentially i am following the basic SUMIF syntax:

=sumif(range, criteria, [sum_range])

My formula searches a worksheet column and locates a specific COUNTY name and adds the total DOLLARS from another column in the same worksheet.

actual formula:
=SUMIF('Contract Eff 2010'!U:U,A7,'Contract Eff 2010'!G:G)

range = a column on the a separate worksheet = 'Contract Eff 2010'!U:U
criteria = a value in the adjacent column (COUNTY) = A7
sum_range = a column on the separate worksheet containing DOLLAR amounts

The problem I am running into is that several US States have counties with the same name (Suffolk, NY and Suffolk, MA) so i need to add a second condition to the SUMIF statement to search another column containing the state abbreviations.

IS IT POSSIBLE TO ADD ANOTHER CONDITION TO A SUMIF STATEMENT?

Answer : How to write an excel =sumif formula with multiple conditions

cyberkiwi, when you use multiplication in SUMPRODUCT you don't need the double unary for the coercion of True and False to 1 and 0. The multiplication will already do that. So either

=SUMPRODUCT(('Contract Eff 2010'!U:U=A7)*(<2nd condition>)*'Contract Eff 2010'!G:G)

or

=SUMPRODUCT(--('Contract Eff 2010'!U:U=A7),--(<2nd condition>),'Contract Eff 2010'!G:G)

If there is a possibility of the data in column G containing text as well as numbers, then the first version will throw an error, the second one won't. For more info on Sumproduct errors see http://spreadsheet-toolbox.com/library/excel-functions/sumproduct-and-its-error-message/

cheers, teylyn
Random Solutions  
 
programming4us programming4us