Quarterly totals when you have multi-year data [SUMPRODUCT again]

Share

Facebook
Twitter
LinkedIn

In yesterdays post – Find Quarterly Totals from Monthly Data, we have learned how to use SUMPRODUCT formula to find totals by Quarter from a set of monthly values. The approach is fine, but has one glaring draw back.

It only works when you have data for one year.

In that post, Martin said,


Ever since i read this post, I am struggling with a table that has the same layout as the example, and I wanted to add the totals per year and per Q, years as rows, Qs as columns.

So, you want to get the totals like this:

Quarterly totals when you have multi-year data

Of course, the easiest and quickest option is to use a pivot report with grouped dates. It takes a few clicks and you have the data.

Quarterly Totals from Monthly Data - Excel Pivot Report

  1. Make a pivot table with your multi-year data
  2. Now add months to either “rows” or “columns” area.
  3. Sales to the “values” area.
  4. Right click on row and select “Group”
  5. Select “Quarters” and “Years” [learn more about grouping dates in pivot reports]
  6. And your report is ready.

But if prefer a formula version, like Martin does, then,

Assuming you have quarters in a column and years in a row (cells F4:H4), like this:

Quarterly Totals from Multi-year Monthly Data in Excel

And monthly data in the range: B4:C39,

The formula will be,

=SUMPRODUCT((ROUNDUP(MONTH($B$4:$B$39)/3,0)=ROWS($E$5:E5))*($C$4:$C$39)*(YEAR($B$4:$B$39)=F$4))

How this formula works?

Today is Friday and I am not in a mood to explain how this formula works. But I will give you some clues,

  • The Red portion finds if a month is in Q1 [ROWS($E$5:E5) is used to get running numbers – learn more about this technique]
  • The Green portion finds if a month is in the given year
  • The Blue portion is the actual values

Now,  run to the espresso machine, get a latte and figure out why this works.

Download the example file:

I have enhanced yesterdays file with multi-year data and added both pivot report and formula based quarterly totals in the file. Go ahead and download it. Play with the file to learn how this works.

Share your tips and ideas:

We have excel rockstars like Daniel Ferry telling us some really awesome ways to improve the formula yesterday. I encourage you to share more tips and ideas on how you usually handle situations like these.

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

6 Responses to “Using Lookup Formulas with Excel Tables [Video]”

  1. Damian says:

    H1 !
    this is my very first comment.
    Can you use same technique with Excel 2003 lists ?
    thanks 😀

  2. Tom says:

    Thanks, Chandoo! I like seeing the sneak peak of what's to come on Friday too 🙂

  3. Chandoo says:

    @Damian.. Welcome to chandoo.org. Thanks for the comments.

    Yes, you can use the same with Excel 2003 lists too.

    @Tom.. You have seen future and its awesome.. isnt it?

  4. Q.fg says:

    Hi, is there a vlookup formula for the second example (IDlist)? I used a similar formula to look up the ID for the person, but the reverse way (look up the person with the ID) comes up N/A.

Leave a Reply