Sum by month

Sum by month

Related Functions

Sponsored Link

=SUMIFS(values,date_range,">="&A1,date_range,"<="&EOMONTH(A1,0))

To sum by month, you can use a formula based on the SUMIFS function, with help from the EOMONTH function.

In the example shown, the formula in F4 is:

 
=SUMIFS(amount,date,">="&E4,date,"<="&EOMONTH(E4,0))

How this formula works

The SUMIFS function can sum ranges based on multiple criteria.

In this case, we configure SUMIFS to sum amounts by month using two criteria: one to match dates greater than or equal to the first day of the month, one to match dates less than or equal to the last day of the month. In other words, we need a formula like this:

 
=SUMIFS(amount,date,">="&"1/1/2016",date,"<="&"1/31/2016")

Or the safer alternative:

 
=SUMIFS(amount,date,">="&DATE(2016,1,1),date,"<="&DATE(2016,1,31))

(Safer because the dates are constructed with separate year, month, and day values, and not entered as text that needs to be interpreted by Excel).

Normally, this is a pain, because if you add month names as text (i.e. “January”, “February”, “March”, etc.) in column E you have to go to extra trouble to create dates you can use for criteria.

However, in this case, we use a simple trick to make things easy: In column E, instead of typing month names, we add actual dates (1/1/2016, 2/1/2016, 3/1/2016), then use a custom date format (“mmmm”) to display the month names.

This makes it easy to build the criteria we need for SUMIFS. To match dates greater than or equal to the first of the month, we use:

 
">="&E4

And to match dates less than or equal to the last day of the month, we use:

 
"<="&EOMONTH(E4,0)

where EOMONTH automatically returns the last day.

The concatenation with an ampersand (&) is necessary when building criteria that use a logical operator with a numeric value.

Pivot Table solution

A pivot table is an excellent solution when you need to summarize data by year, month, quarter, and so on, because they will do this kind of grouping for you without any formulas at all. For a side-by-side comparison of formulas vs. pivot tables, see this video: Why pivot tables.

Sponsored Link

0 votes. 0 / 5

Excel - Excel Functions - Excel Formulas
Logo