can be done with SUMIF
The SUMIF Function
Summing with Excel's SUMIF Function
Let's say that you have a set of data with columns for dates, products, cities, salespersons, quantities and unit prices. With the SUMIF function, you can sum quantities based on a single criteria like date OR product OR salesperson... SUMPRODUCT is like Excel SUMIF on steroids, with SUMPRODUCT you can sum quantities based on date AND product AND salesperson AND any number of other criteria...
When you use Excel SUMPRODUCT function in a report to look at a set of data, you can just change the data and the report is AUTOMATICALLY refreshed.
The Excel SUMIF Function
The general format for the SUMIF formula is as
The Excel SUMIF function is limited to one criteria (one column). If you want to sum the amounts based on month, State and name, discover the very simple SUMPRODUCT function with which you can use 2, 3 or more criteria with "or" "and"...SUMPRODUCT is like SUMIF on steroids.