Aggregating Monthly Sales from a Larger Data Set

Written by Allen Wyatt (last updated November 22, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


2

Tonya has a worksheet that contains sales transactions for the past two years. The data is imported daily from an external reporting system. The data is simple; column A is the date and column B is the amount. On a different worksheet, Tonya would like to create a small table that represents aggregate sales for just the past six calendar months. Column A would be the month, column B would be the count of sales, and column C the sum of sales. She knows she could do this with a PivotTable, but she would prefer to do it using formulas, if possible. That way she can include the aggregate data in a larger report that she is putting together.

I'm going to make an assumption here that Tonya's transaction data is in a worksheet called "Import," using columns A:B as she indicated. In order to get the information she wants, on a different worksheet she can add the headings "Month," "Count," and "Sales" in cells A1:C1. Then, she can use the following formula in cell A2 in order to indicate the start of the month:

=EOMONTH(TODAY(),SEQUENCE(6,,-1,-1))+1

This will spill down in A2:A7, providing the starting date of each of the previous six months. Next, the count of transactions during the month can be determined with this formula in cell B2:

=LET(a,Import!A:A,ROWS(FILTER(a,(a >= A2) * (a < EDATE(A2,1)))))

Finally, the sum of those transactions can be determined with the following formula in cell C2:

=SUM(FILTER(Import!B:B, (Import!A:A >= A2) * (Import!A:A < EDATE(A2,1))))

Now, you can copy the formulas in B2:C2 down to rows 3 through 7 and you end up with the six months of aggregate data that Tonya is seeking.

The formulas presented so far use functions that will only work in Excel 2021, 2024, and Microsoft 365. If you want formulas that will work in older versions of Excel, place the following into cell A2, B2, and C2, respectively:

=EOMONTH(TODAY(),-ROW(A1))+1
=COUNTIFS(Import!A:A,">=" & A2,Import!A:A,"<" & EDATE(A2,1))
=SUMIFS(INDEX(Import!B:B,0),INDEX(Import!A:A,0), ">=" & A2,INDEX(Import!A:A,0), "<" & EDATE(A2,1))

Copy A2:C2 down to rows 3 through 7, and you have the information required.

Note that all of the formulas in this tip work on the entirety Import!A:B. If you notice that the calculations are slow at all, you can modify the ranges to reflect just the cells you want checked, as in A2:A5000 instead of A:A.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9703) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Returning a Weight and a Date

If you have two columns containing dates and weights from those dates, you may want to pick a date associated with a ...

Discover More

Rounding to the Nearest $50

When preparing financial reports, it may make your data easier to understand if you round it to the nearest multiple, ...

Discover More

Turning Off the Check for Repeated Words

If your work involves the usage of repeated words, you may be interested in configuring Word so it doesn't flag those ...

Discover More

Dive Deep into Macros! Make Excel do things you thought were impossible, discover techniques you won't find anywhere else, and create powerful automated reports. Bill Jelen and Tracy Syrstad help you instantly visualize information to make it actionable. You’ll find step-by-step instructions, real-world case studies, and 50 workbooks packed with examples and solutions. Check out Microsoft Excel 2019 VBA and Macros today!

More ExcelTips (ribbon)

Selecting Ten Random Numbers

If you need to generate a group of random numbers, you may be at a loss as to where to start. This tip looks at easy ways ...

Discover More

Determining a State from an Area Code

Want to be able to take information that is in one cell and match it to data that is contained in a table within a ...

Discover More

Dealing with Long Formulas

If your worksheet formulas seem to go on forever, here's a handy way to make them more understandable. (All you need to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four more than 4?

2025-11-24 11:10:21

Allen

@Julie: Right in the middle of the tip it says "The formulas presented so far use functions that will only work in Excel 2021, 2024, and Microsoft 365." Then, I provide a way to accomplish the task that will work in your version.

-Allen


2025-11-24 11:02:02

Julie

Nice tip; however, not all the listed versions of Excel have all the listed functions. For example, my work computer has "Professional Plus 2019" and does not have LET, SEQUENCE, or FILTER. I assume none of the earlier versions have them either.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.