Excel Dynamic Array Functions are a true game changer. These newly introduced DA functions can filter, sort, remove duplicates and do much more. The output of these functions can go to a range of cells. Hence the name – dynamic array functions.
Table of Contents
How Dynamic Array Functions differ from normal functions?
- Normal functions return value in ONE cell, where as DA functions return output to a range of cells
- New ways to work with data - FILTER, SORT, extract UNIQUE items and generate SEQUENCE of numbers or random values
- Can be use alone or with existing Excel functions
- Available in Excel 365 only
What are the newly introduced DA functions?
As of April 2020, Microsoft introduced below 6 new functions under Dynamic Array category.
- FILTER: to filter a range of cells (or table) based on input criteria
- UNIQUE: to extract unique items from a a range of cells (or table)
- SORT: to sort a list by a specified column.
- SORTBY: to sort a list by another list
- SEQUENCE: to generate a sequence of numbers in a range of rows and (or) columns.
- RANDARRAY: to generate a range of random numbers
Apart from these new functions, DA capability enables these extra features in Excel.
- You can use # operator to refer to a range of cells spilled by Dynamic Array functions. For example, if A1 has a DA function that returns 10×1 range (A1:A10), you can refer to this dynamic range by using the reference A1#
- Most array formulas will now simply spill into a range of cells. No need to press CTRL+SHIFT+Enter.
- Newly introduced formulas like XLOOKUP can also spill producing an entire row of matching result.
- Any formula or name that refers to more than one value will automatically spill. For example, if you type =data in a cell, it will return the entire table in a spilled range.
Sample Data
I am using the below Employee data to demonstrate new Dynamic Array functions. This is in a table named “data”.
Please go thru below fact sheets to learn more about DA functions.
FILTER() Fact Sheet
What does FILTER() do?
FILTER() function filters a table or list of data based on conditions.
Show me a demo of FILTER?

What is the syntax of FILTER function?
=FILTER(your data, conditions, if empty value)
Give me few examples of FILTER function?
Here are a few more examples of FILTER function:
- FILTER(data, data[manager]=”Ian”)
Shows all data where manager is Ian. - FILTER(data, (data[age]>30)*(data[department]=”Website”))
All data where age > 30 AND department is Website. - FILTER(data[name], (data[age]>30)+(data[department]=”Website”))
Show names where Age > 30 OR department is Website. - FILTER(data, (data[Manager]<>”Ian”)*(data[gender]=”Female”))
Show female staff data where manager is NOT Ian
UNIQUE() Fact Sheet
What does UNIQUE() do?
UNIQUE() function generates a list of unique items from input. You can use it to remove duplicates from a list.
Show me a demo of UNIQUE?

What is the syntax of UNIQUE function?
Simplified syntax:
=UNIQUE(list)
With options:
=UNIQUE(list, data is across the columns?, do you want values occurring just once?)
Give me few examples of UNIQUE function?
Sure. Here are few more practical examples of UNIQUE function.
- UNIQUE(data[department])
List out all department, just one row per department. - UNIQUE(FILTER(data[department], data[age]>30))
List out all departments where staff aged >30 work. - UNIQUE({1;1;2;3;4;4;5;6;7;7;7;8;9;0;0}, FALSE, TRUE)
Return the numbers that occurred just once – ie {2;3;5;6;8;9}
SORT() Fact Sheet
What does SORT() do?
SORT() function sorts a list or data by the column number specified in ascending or descending order.
Show me a demo of SORT?

What is the syntax of SORT function?
Common usage:
=SORT(list)
With options:
=SORT(list, column number, ascending or descending order, do you want to sort across the columns instead?)
Give me few examples of SORT function?
Here are a few more examples of SORT function:
- SORT(data[name])
Sorts all the names in data in ascending order (the default order) - SORT(data, 6, -1)
Sorts all data by salary (column 6) in descending order (-1) - SORT(FILTER(data, data[manager]=”Carla”),4)
Shows all staff data that report to Carla in ascending order of age (column 4).
How does SORT break ties?
Let’s say you are sorting the staff data by age with the formula SORT(data, 4). In this case, if two employees have same age, then SORT will present them in the order as per original data. So if Bill and Jill both are 19, but they are listed Bill first in data, that is how SORT will show the result too.
How to use another column to break ties when SORTing?
In such cases, you can use the next function – SORTBY. This accepts multiple criteria to break ties.
SORTBY() Fact Sheet
What does SORTBY() do?
SORTBY() sorts a list (or table) by a set of criteria lists. You can use this to break ties or defined multi-level sorting criteria (for ex: sort by department and age).
Show me a demo of SORTBY?

What is the syntax of SORTBY function?
SORTBY(list, criteria list 1, sort order 1, criteria list 2, sort order 2…)
Give me few examples of SORTBY function?
SORTBY opens up lots of possibilities to analyze and present data in meaningful manner. Here are few real-world scenarios.
- SORTBY(data, data[Department],1, data[Salary],-1)
Sort data by department in A-Z order and then Salary in descending order. - SORTBY(data[name], data[Department],1, data[Salary],-1)
Sort data by department in A-Z order and then Salary in descending order, but just show the names. - SORTBY(data, data[Department]=”HR”, -1, data[Name],1)
Shows all employees in HR department on top and rest underneath in alphabetical order.
SEQUENCE() Fact Sheet
What does SEQUENCE() do?
SEQUENCE() function generates a sequence of numbers in rows or columns or both. You can use this to make running numbers. While this may not seem all that helpful, SEQUENCE opens up doors for creating elegant and powerful solutions for your data analysis needs.
Show me a demo of SEQUENCE?

What is the syntax of SEQUENCE function?
Common usage:
=SEQUENCE(count)
With options:
=SEQUENCE(row count, column count, starting number, step by)
Give me few examples of SEQUENCE function?
Here are a few more examples of SEQUENCE function:
- SEQUENCE(10)
Generates numbers 1 to 10 and spills them in to 10 cells. - SEQUENCE(100)<=10
Generates 100 values, with first 10 as TRUE and others as FALSE - FILTER(SORT(data, 6, -1), SEQUENCE(100)<=10)
Shows data for top 10 employees by salary. - SORTBY(data, SEQUENCE(100), -1)
Prints data in reverse order (by sorting the sequence of 100 numbers in descending order)
RANDARRAY() Fact Sheet
What does RANDARRAY() do?
RANDARRAY() makes a list of random numbers. Just as SEQUENCE(), RANDARRAY() too doesn’t seem like a useful function, until you need it.
Show me a demo of RANDARRAY?

What is the syntax of RANDARRAY function?
Common usage:
RANDARRAY(count)
With options:
RANDARRAY(row count, column count, starting number, ending number, do you want just random integers?)
Give me few examples of RANDARRAY function?
Here are a few real-world examples of RANDARRAY.
- RANDARRAY(10,,1,100,TRUE)
Generate 10 random integers between 1 to 100 - UNIQUE(RANDARRAY(10,,1,100,TRUE))
Generates 10 random integers between 1 to 100 and removes any duplicates in them. - SORTBY(data, RANDARRAY(100))
Shuffles the data in random order
How Dynamic Arrays interact with other Excel features?
DA functions and spill ranges play well with most Excel functionalities. I have made a few notes and comments about individual features below.
Spill Ranges in other formulas
You can refer to spill ranges (output generated by Dynamic Array functions) using the # operator.
For example, let’s say you have a formula in cell B7 to filter all salaries of people reporting to Carla.
You can refer to the entire spilled range in other situations using # operator like this.
- SUM(B7#) – sums up all salaries listed in the cell B7 and down. This formula will automatically adjust if either data or filter conditions change.
- AVERAGE(B7#) – similar to SUM, but calculates average salary
- COUNTIFS(B7#, “>100000”) – counts number of values in the spill range (B7#) greater than $100,000
See this illustration to understand how to work with spill ranges in other formulas.

Named ranges and DA Functions
You can create named ranges that refer to Spill range. You can also use named ranges inside DA functions. Everything works just as smoothly.
For example,
- We can create a named range called HighPerformers that refers to the formula =FILTER(data, data[Rating]>=5). See this illustration.

- We can then use this named range in other formulas (or situations). To count number of high performers, we can use =ROWS(HighPerformers)

When you combine the DA functions with array processing power of INDEX, you can solve some gnarly business problems easily.
Conditional Formatting Dynamic Arrays
As of April 2020, Conditional formatting doesn’t really recognize dynamic spill ranges. This means, when you create a CF rule to be applied to an entire spill range, even though Excel let’s you enter B7#, it will automatically convert the range to physical address (for eg. $B$7:$B$19).
So if your data or formula changes, the CF rules won’t automatically extend.
Dynamic Arrays in Data Validation
You can use # operator when referring to dynamic array range with data validation rules.
For example, you can set a data validation drop down list in a cell to show all department names in ascending order using below method:
- In an empty cell (say AH6), write the formula =SORT(UNIQUE(data[Department]))
- Now, select the cell where you want to apply data validation, go to Data > Validation and select the type as List.
- Set list source as $AH$6#
- You can select departments from your validation list.
See this illustration on how this can be useful.

Charting & Dynamic Arrays
As of April 2020, Excel charts do not recognize spill range operators. This means, when you create a chart from spilled range, it will not automatically extend if the data / formula changes.
Here is a quick demo of this broken chart behavior.
Dynamic Array Functions - Full Introduction Video
I created a detailed video explaining how dynamic array functions work, how to get started and what to do when you get errors. Check out the video below or visit Chandoo.org youtube channel.
Dynamic Array Functions - Masterclass
I ran a live YouTube stream on Dynamic Array formulas recently. You can watch the video below. This covers all the concepts of Dynamic Arrays in great detail.
Example Workbook
I made a full example workbook with sample data, several formulas, interaction details and more. Please use below button to download the file.
Note: It will work ONLY if you have Dynamic Array feature in Excel 365.
Additional Resources on DA Functions
Please check out below links and videos to learn more about DA functions.
- Dynamic Arrays in the traditional Excel world [Microsoft]
- Overview of Dynamic Array functions [Excel Campus]
- Excel Dynamic Arrays – Straight to the point – Book by Bill Jelen [MrExcel]
- Joe McDaid, Program Manager at Microsoft Explains the DA functionality – Video
- Also learn about XLOOKUP – another cool new function














34 Responses to “Find Quarterly Totals from Monthly Data [SUMPRODUCT Formula]”
Chandoo,
Very nice post. In most cases I would use a formula such as yours so that copying is automatic. But for instructional purposes, consider this alternative for the Q1:
=SUMPRODUCT((MONTH(B$4:B$15)={1,2,3})*C$4:C$15)
Besides being shorter, this formula is crystal clear in function. Then for the other quarters you would just change the array constants to the months of that quarter. For example, Q2:
=SUMPRODUCT((MONTH(B$4:B$15)={4,5,6})*C$4:C$15)
Now I know there are a lot of accountant types out there that think using constants in a formula is some sort of heresy. I think that idea is silly. If the formula is clear and maintainable, constants are ok by me. But if this idea shakes anyones soul, these constants could easily be encapsulated in named formulas and then the formula above could look like this:
=SUMPRODUCT((MONTH(B$4:B$15)=Quarter1)*C$4:C$15)
The SUMPRODUCT function is truly magical, as you put it. This article goes into some advanced uses:
http://www.excelhero.com/blog/2010/01/the-venerable-sumproduct.html
Regards,
Daniel Ferry
excelhero.com
I have a column of dates(xx/xx/xx) on a sheet that represents when a task is completed. How do I code a formula on a separate sheet(Summary Page) of the total number of completions within a quarter?
ie;
Task Date Completed
task1 02/05/14
task2 04/01/14
task3 08/01/14
I need a formula that scans that column and then adds the number of tasks completed within each quarter of the year.
Chandoo,
as usual, great tip.
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. The first thing I've noticed is that I had to add the double minus to the roundup portion in order to make it work, even my dates ARE dates...but what i cannot figure out is how to summarize by year. I've tried adding a Year(a1:a20)=2010 to the sumproduct, but it returns 0, and I have the Pivot table below to prove that wrong (aaah, how easy was to have that with the pivot table....!!)
btw, I was playing around with PTs, adding calculated fields and items to solve variations between Actuals and Budgets and Prior Years. Once you get the formulae right, it's sooooo easy to do, and the results are awesome !!!
all the best,
Martín
Amended Chandoo's formula to add a year and it worked fine.
SUMPRODUCT((YEAR($B$4:$B$15)=2010)*(ROUNDUP(MONTH($B$4:$B$15)/3,0)=ROWS($E$4:F4))*$C$4:$C$15)
Chandoo
I generally do quarters in the same way galthough I would have changed the number format of cells E4:E7 to Q0, so that I could reduce to formula length by referring directly to these cells. SUMPRODUCT((ROUNDUP(MONTH($B$4:$B$15)/3,0)=E4)*$C$4:$C$15).
I like Daniel's suggestion of a named range. Great site.
Thanks Chandoo,
I use a tbl to create relationshipp for each period to its quartile
Jan Q1
Feb Q1
Mar Q1
Create a lookup in a helper column to lookup the correct quartile.
Use Sumif on the column with the quartile
Best regards,
Winston
@Daniel: Excellent insights as always. I am finding SUMPRODUCT formula really really powerful.
I didnt know that we can write conditions like ={1,2,3}. I remember trying that but it didnt work. thanks for telling me how to do it. I like your idea of named ranges. It will keep things simple and also let the reports to easily transformed if one needs to change Q1 from JAN-MAR to APR-JUN.
@Martin: See Alan's comments. Also, I liked your question, so I am doing a follow up post on it today. Refer to it to find out how you can get quarterly totals from multi-year monthly data.
@Alan: Very good tips. Thank you. Infact, in the download file you would find the formula to be slightly different. I used ROWS() so that I need not change the values for each quarter. I guess either technique works fine.
@Winston: Thanks for sharing your technique. Using helper columns is a fine option too. It keeps the formulas clean and simple. I was just curious and investigated to find if there is a formula that would avoid helper columns.
Chandoo, I learn so much from your posts. Thank you for this!
I was wondering, how would this get applied to a dashboard with a dynamic date slider?
Right now I show sales for the week, month, and year based on the date I choose. I've yet to discover how to calculate quarterly numbers based on my date selection.
My date is determined by: =DATE(2018,12,31)+7*(A2-1) with A2 updating based on the slider.
Sales This Month is calculated as: =SUMPRODUCT((MONTH(Data[Order Date])=MONTH(D2))*(Data[Sales Amount])) with D2 containing the date formula above.
ANy suggestions?
Thanks for your question Jason.
It seems you have data at date (or even lower level). In such cases, you need either two conditions or probably SUMIFS to solve this. For example with SUMIFS,
=SUMIFS(data[sales amount], data[order date],">="&quarter_start, data[order date],"<"&quarter_end) where quarter_start = date(year(a2), choose(month(a2), 1,1,1,4,4,4,7,7,7,10,10,10), 1) and quarter_end = date(year(a2), choose(month(a2), 4,4,4,7,7,7,10,10,10,13,13,13), 1) can work.
How about if we have the data in weeks and we want to roll it up in Q1, Q2, Q3, Q4
will this work for Q1:
=SUMPRODUCT((MONTH(B$4:B$15)={1,2,3,4,5,6,7,8,9,10,11,12,13})*C$4:C$56)
nice article to use the new things on the excel to calculate the needed ports...The use of tables shows the image view than the wordings, since images are easily recorded in the mind of users than the words to be read...
[...] Quarterly data in a formula May 4, 2010 at 9:12 AM | In General | Leave a Comment Tags: month, formulas, flag, quarter, sumproduct Chandoo wrote a post about combining the power of SUMPRODUCT with a small mathematical trick in order to calculate a quarterly sum from a monthly data table. [...]
I have an issue, much different yet has some similarities...
I have two worksheets... 'Summary' worksheet and 'Stop pays' worksheet.
The summary sheet has the $ amount of checks paid each week. (example. A1= 1/1/10, B1= $100,000.00; A2= 1/8/10, B2= $120,000.00, A3= 1/15/10, etc...for 52 weeks)
On the stop pays sheet is a list format of each check that was voided at a later date... (example. column A= original check date, column B= check voided amount, column C= void date. A2= 1/1/10, B2= -$100.00; A3 = 1/1/10, B3= -$150.00; A4= 1/1/10, B4= -50.00; etc...)
On the summary sheet in C1, I need to calculate the total checks actually paid out. I have been trying to use combinations of SUMPRODUCT with VLOOKUPS, but can't get anything to work. The result in C1 should $99,700.00
Any thoughts, all help is appreciated. Thanks, Kyle
@Kyle
Give this a try in Summary!C1 and copy down
=SUM($B$1:B1)+SUMPRODUCT(1*('Stop Pays'!A2:A100<=Summary!A1)*('Stop Pays'!$B$2:$B$100))
@Kyle... you can use sumif formula...
Assuming your summary sheet is in range A1:B10, stop pays sheet is in range A1:B20.
in summary c1 write = b1 - sumif('stop pays'!$a$1:$a$20,a1,'stop pays'!$b$1:$b$20)
Read more about sumif formula here: http://chandoo.org/wp/2008/11/12/using-countif-sumif-excel-help/
@Hui. Thanks, but for some reason this only worked for the first row (C1), when I copied down the results werent accurate.
@Chandoo. This seems to work perfectly. Thank you.
Thanks again.
@ Kyle
Chandoo's formula is giving the amount each month (Cheques - Stop Pays)
Mine is giving a running total from 1/1/10 to the date in Summary!Column A
I have monthly data in one sheet and want to calculate quarterly and annual data is two other sheets. all monthly data is arranged across columns. so A1 is jan 2000, b1 is feb 2000, c1 is march 2000 and so on.
Please help
@Priyank: Assuming your months are (in date format) in A1:X1 and corresponding values are in A2:X2, you can calculate quarterly totals like this:
=SUMPRODUCT((ROUNDUP(MONTH(A1:X1)/3,0)=1)*(A2:X2)) for Q1. Modify it to get Q2... etc.
you can use similar logic with YEAR() to get yearly totals.
This formula is not working properly in one of my sheets with horizontal cash flows using columns instead of rows. For example, Q1 only sums M1 and Q2 is summing up M2:M4. It doesn align propoerly. The formula works if I create a simple test using same format in excel but not in the model. Can I send the excel to someone?
Thanks,
Marc
Item 01-Mar 02-Mar 03-Mar 04-Mar Tot.
Soap 24 12 15 13 (E5-F5)+(G5-F5)+(G5-H5)
Ketchup 12 10 8 14
Tea 10 8 5 8
Soup 12 7 9 11
Coffee 22 26 14 13
Hi!!,
I need your help in fixing above problem.
I do get day day wise closing stock of my company.To get day sales have to
substract today's no from prev.day's no. But sometimes today's no is big due to receipt of stock.That time I need to substract prev.day's no from today'no. Pls see formula in tot column.Like this I have to do for 31 days and 250 items.I want one formula in one cell give final result(tot)by satisfying above conditions else I have to punch a formula in above column which is boring ang time consuming.Thanks in advance.
Hi Chandoo et al,
My question builds on the post regarding quarterly totals from monthly data. I'm having trouble getting the formula to work when the time period I want quarterly totals for exceeds 12 months. In my case, I have 240 months and need these to be collapsed into 60 quarters. Any suggestions? Or should I simply cut and paste the formula for each 12 month period?
thanks
Hi Chandoo,
I have a similar problem, but with a twist. I often compare actual and budget data where the actuals are in one range with Jan-Dec data and the budget is another range with Jan-Dec data.
The problem I have is that at the beginning of the year I know the budget for all 12 months, so my range is populated for Jan-Dec. The actual data is populated as we complete those months.
Here's the rub: when caluclating totals for Oct, say, the formula to retrieve Q4 data needs to be smart enough to NOT include the November and December budget amounts, which are already populated in the table.
how can I do the same using SQL query?plz help
[…] Find Quarterly Totals from Monthly Data [SUMPRODUCT Formula] | Chandoo.org - Learn Microsoft Excel O… […]
How do we use this for getting totals for the latest qtr? anybody?
My challenge is I don't want to use a helper column. Want to derive the latest qtr and then average the numbers for that qtr . Ex this gives an error :
AVERAGEIF((ROUNDUP(MONTH($A$2:$A$7)/3,0),(ROUNDUP(MONTH(MAX($A$2:$A$7))/3,0)),B2:B7))
Hi
I am arranging a spread sheet for work but am struggling with a date function. we have customers in our service for up to 2 yrs, however we have to calcuate the number of days they have been in service each quarter. For example Q1 will run from 15/01/15 to 06/04/15 but my customer could have joined on 03/09/14 ... i don't want to calulate all the days just the days in the quarter... which should be upto 91 days max. Can any one help at all?
Dear all
I can see your formula and I think it works perfectly for what I want to achieve, ie pull quarterly figures from a range showing monthly data. There's only one problem. I cannot follow how the sumproduct formula is working in this case. Could anyone please help with an explanation on what is going on in that formula so I can hopefully be able to apply it.
Thanks
Hi,
I need to come up with a way to show the current quarters info, this would be run off the month end date.
For example: If the month end date is 28.2 then I need to bring back Jan data and Feb data or if the end date was 31.3 I would need to total Jan, Feb and Mar data.
I am thinking of creating unique references such as the quarter plus which month it is in the quarter ie if it was feb, the unique reference would be Q12 (Q1 for the quarter and 2 for the month as it is the 2nd month in the quarter). Would I need to use an index or offset formulae.........
Any help would be appreciated.
Greetings,
Can we make this a little more involved just month and sales results.
What if I have the following columns:
Vendor Name
Market
Line of Business
Month
Sales
Now I want to calculate the average quarterly sales by vendor, Market, and Line of Business
Hello Hesham... thanks for your question. You should use Pivot Tables for such things. See here for a getting started guide - https://chandoo.org/wp/excel-pivot-tables-tutorial/
Im a little confused, I have the following table of sales
Sales Sheet
ColA=dates(dd/mm/yyyy)
ColE=amount(total amount of sales in $)
eg
A E
11/02/2020 $20.00
01/01/2020 $15.00
03/12/2020 $16.00
05/07/2020 $23.00
etc etc
Report Sheet
I want to report the running total of sales for each quarter and update the figures here as more get added
Cell B2= Quarter1 total
Cell B5= Quarter2 total
Cell B8= Quarter3 total
Cell B11= Quarter4 total
How do I read the Sales Sheet column A selecting all dates for each quarter and sum total them in The Report sheet. I have tried mucking about with your formula but I just keep getting errors, any help much appreciated
I have problem Statement, my data are monthly i need to do comparison at QTD level say i am second quarter May (so my data should only pick April and May total) and( when in June it should pick Apr+ May +June) - can i your help on this
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
1 2 3 4 5 6 7 8 9 10 11 12