Summing Values by Month in Excel with SUMIF and SUMPRODUCT
If you have dates in a column and want to sum values based on the month, Excel offers two handy functions: SUMIFS and SUMPRODUCT. With SUMIFS, you can specify a date range that falls within a particular month and year, while SUMPRODUCT allows you to sum values for a specific month, regardless of the year. Here’s how to use these formulas:
Sum Values by Month and Year with SUMIFS
Suppose you have data for three years (2021, 2022, and 2023) and want to sum the values for a specific month and year. You can use the following steps:
- Start by typing the SUMIFS function in a cell and specify the range where you want to get the sum.
- In the criteria_range1 argument, enter the range where your dates are located.
- For the criteria argument, use the greater than or equal to operator (“>=”) and the DATE function to create a valid starting date for the month and year you want to sum. For example, to sum values for January 2022, enter (“>= “&DATE(2022,1,1)).
- In the criteria_range2 argument, refer to the date range again.
- For the criteria2 argument, use the less than or equal to operator (“<=”) and the EOMONTH function to get the last day of the month and year you want to sum. For example, to sum values for January 2022, enter (“<= “&EOMONTH(“01-Jan-2022”,0)).
- Close the parentheses and hit enter to get the result.
The formula will sum up all the values between the starting date and the last day of the specified month and year.
Here’s the complete formula: =SUMIFS(B2:B103,A2:A103,”>=”&DATE(2022,1,1),A2:A103,”<=”&EOMONTH(“01-Jan-2022”,0))
Sum Values by Month Regardless of the Year with SUMPRODUCT
If you want to sum values for a particular monthRegardless of the year, you can use the following formula:
=SUMPRODUCT(B2:B103,–(MONTH(A2:A103)=1))
In this formula:
- Use the MONTH function to check if the month in each date is equal to the specified month (in this example, January, which is represented by the number 1).
- Use the double minus sign to convert the resulting TRUE/FALSE values to 1/0.
- Multiply the arrays (quantity and 0-1) to get the sum for the dates where the month is January.
This formula will sum up all the values for the specified month, regardless of the year.
By using these formulas, you can easily sum values based on the month in Excel.