# How to sum by date and type in Excel 2010

We have a peculiar need where we haven't seemed it anywhere else.  We need to totalize by Date and Type (see excel attached).  We have placed the calculation individually by DATE and by TYPE. At the top of the excel is what we want (we sum it manually so EE can see what we want), by both DATE and TYPE.
###### Who is Participating?

Commented:
Try the following formula in cell F3. It may be copied across and down.
=SUMPRODUCT((MONTH(\$A\$7:\$A\$28)=MONTH(F\$2))*(\$B\$7:\$B\$28=\$E3),\$C\$7:\$C\$28)
0

Author Commented:
forgot the excel.
AmtByDates-Type.xls
0

Author Commented:
Ok will try.
0

Author Commented:
Worked Perfectly!

Can you explain the formulas for us to better understand?
0

Commented:
The SUMPRODUCT function may be used to sum or count cells subject to certain criteria, with those criteria tested on a row by row basis. This use is not documented by Microsoft, but is widely used in the expert community in Excel forums. It also works in all versions of Excel, whereas the COUNTIFS and SUMIFS functions with similar abilities work only in Excel 2007 and later.

In this particular case, we have two criteria that have to be met: one for the date and another for the type. Each criteria is expressed as a Boolean expression. The Boolean expressions return an array of TRUE and FALSE values--but when you multiply them by each other (or by another number), Excel converts TRUE into 1 and FALSE into 0.

(MONTH(\$A\$7:\$A\$28)=MONTH(F\$2)    Boolean expression testing dates in column A to see if month matches the column header in F2

(\$B\$7:\$B\$28=\$E3)    Boolean expression testing type in column B to see if it matches that in cell E3

,\$C\$7:\$C\$28      the cells being summed if they match both of the preceding criteria. The comma before the expression allows SUMPRODUCT to tolerate (and ignore) text values, should any be present in column C. It could also be written with a leading asterisk if all values in column C are numeric--but SUMPRODUCT will return an error value if even one cell contains text.
*\$C\$7:\$C\$28

Note that if your dates in column A span more than one year, you will want to add a year criteria to the formula.
=SUMPRODUCT((MONTH(\$A\$7:\$A\$28)=MONTH(F\$2))*(YEAR(\$A\$7:\$A\$28)=YEAR(F\$2))*(\$B\$7:\$B\$28=\$E3),\$C\$7:\$C\$28)
0

Author Commented:
Thanx a lot!
0

Author Commented:
Thanx!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.