(Excel examples for Beginners)
In this end-to-end excel example, you will learn – How to Sum by month ignore year in Excel.
How to Sum by month ignore year in Excel
Generic formula
=SUMPRODUCT((MONTH(dates)=month)*amounts)
Explanation
To sum data by month, ignoring year, you can use a formula based on the SUMPRODUCT and MONTH functions. In the example shown, the formula in H6 is:
=SUMPRODUCT((MONTH(dates)=3)*amounts)
The result is a total of all sales in March, ignoring year.
How this formula works
This data set contains over 2900 records, and the formula above uses two named ranges:
dates = B5:B2932 amounts = E5:E2932
Inside the SUMPRODUCT function, the MONTH function is used to extract the month number for every date in the data set, and compare it with the number 3:
(MONTH(dates)=3)
If we assume a small data set listing 3 dates each in January, February, and March (in that order), the result would be an array containing nine numbers like this:
{1;1;1;2;2;2;3;3;3}
where each number is the “month number” for a date. When the values are compared to 3, the result is an array like this:
{FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;TRUE;TRUE;TRUE}
This array is then multiplied by the amount values associated with each March date. If we assume all nine amounts are equal to 100, the operation looks like this:
{0;0;0;0;0;0;1;1;1} * {100;100;100;100;100;100;100;100;100}
Notice the math operation changes the TRUE FALSE values into ones and zeros. After multiplication, we have a single array in SUMPRODUCT:
=SUMPRODUCT({0;0;0;0;0;0;100;100;100})
Note the only surviving amounts are associated with March, the rest are zero.
Finally, SUMPRODUCT returns the sum of all items – 300 in the abbreviated example above, and 25,521 in the screenshot with actual data.
Count by month ignoring year
To get a count by month ignoring year, you can use SUMPRODUCT like this:
=SUMPRODUCT(--(MONTH(dates)=3))
Average by month ignoring year
To calculate and average by month ignoring year, you combine the two SUMPRODUCT formulas above like this:
=SUMPRODUCT((MONTH(dates)=3)*amounts)/SUMPRODUCT(--(MONTH(dates)=3))
Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.
Learn by Coding: v-Tutorials on Applied Machine Learning and Data Science for Beginners
Latest end-to-end Learn by Coding Projects (Jupyter Notebooks) in Python and R:
All Notebooks in One Bundle: Data Science Recipes and Examples in Python & R.
End-to-End Python Machine Learning Recipes & Examples.
End-to-End R Machine Learning Recipes & Examples.
Applied Statistics with R for Beginners and Business Professionals
Data Science and Machine Learning Projects in Python: Tabular Data Analytics
Data Science and Machine Learning Projects in R: Tabular Data Analytics
Python Machine Learning & Data Science Recipes: Learn by Coding
R Machine Learning & Data Science Recipes: Learn by Coding
Comparing Different Machine Learning Algorithms in Python for Classification (FREE)
There are 2000+ End-to-End Python & R Notebooks are available to build Professional Portfolio as a Data Scientist and/or Machine Learning Specialist. All Notebooks are only $29.95. We would like to request you to have a look at the website for FREE the end-to-end notebooks, and then decide whether you would like to purchase or not.
Excel formula for Beginners – How to find Max value ignore all errors in Excel
Excel formula for Beginners – How to Average numbers ignore zero in Excel
Excel formula for Beginners – How to Average and ignore errors in Excel