Excel Dynamic Array Functions – What are they, how to use them, Examples and FAQs

Share

Facebook
Twitter
LinkedIn

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?

What are the newly introduced DA functions?

As of April 2020, Microsoft introduced below 6 new functions under Dynamic Array category.

  1. FILTER: to filter a range of cells (or table) based on input criteria
  2. UNIQUE: to extract unique items from a a range of cells (or table)
  3. SORT: to sort a list by a specified column. 
  4. SORTBY: to sort a list by another list
  5. SEQUENCE: to generate a sequence of numbers in a range of rows and (or) columns.
  6. RANDARRAY: to generate a range of random numbers
 
Here is a TLDR version of the Dynamic Array functions.
New Excel Dynamic Array functions - explained in one GIF

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”.

sample data - DA functions

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?

Filter dynamic array function - demo

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?

UNIQUE dynamic array function - demo

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?

SORT function - demo

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?

SORTBY dynamic array function - demo

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?

SEQUENCE dynamic array function - demo

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?

RANDARRAY dynamic array function demo

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.

how to use spill ranges in other formulas - Excel illustration

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,

  1. We can create a named range called HighPerformers that refers to the formula =FILTER(data, data[Rating]>=5). See this illustration.

    creating a named range with FILTER function

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

    Using Dynamic Array functions with named ranges - demo

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:

  1. In an empty cell (say AH6), write the formula =SORT(UNIQUE(data[Department]))
  2. Now, select the cell where you want to apply data validation, go to Data > Validation and select the type as List.
  3. Set list source as $AH$6#
  4. You can select departments from your validation list.

See this illustration on how this can be useful.

data validation rules with dynamic arrays

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.

demo of charts with dynamic array functions

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.

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.

41 Responses to “How to use Excel Data Model & Relationships”

  1. Ashish Youngy says:

    Data is Excel 2013 behaves so much like a OLAP cube when using with PivotTables. And this is actually wow. Consider learning not just DAX but MDX too 🙂 Happy Excel

    @Chandoo.. Have a nice and safe time in US. Best Wishes. And when they are publishing your interview in Entrepreneur 🙂

  2. Buzz says:

    I have been using PowerPivot in Excel 2010. My understanding was (via PowerPivot Pro blog) that Power Pivot would NOT be available in Excel 2013 in all versions; my recollection is that it was only going to be available in certain enterprise subscription editions. Thus, for individual users, it will no longer be available? For that reason I have moved some of my projects to Tableau, and do not expect to upgrade to Excel 2013.
    Can you confirm the availability of Power Pivot for all Excel 2013 users , or will it be restricted and unavailable for some users?

  3. Oz says:

    Just this weekend I upgraded from Home Premium to Professional Plus and spent time with Power View and PowerPivot.

    Up to that point I never saw myself in VLOOKUP Hell, and it may not be going away any time soon. I'm surprised to discover how many of my clients are still on Excel 2003. And then I have Mac users who don't have a lot of this great stuff available to them at all.

    These are great features and I'm going to dive into the Data Models. Unfortunately, I suspect, for me, the practical use may be limited to blogposts because I can't teach Power View in my workshops or send a client a spreadsheet that has a Power View in it.

    • thundom says:

      Hi OZ,

      I think the Microsoft would only upgrade the excel to a certain level instead of making it so powerful that it might threat their BI product. You know these "powerful" stuff can be easily done with a entry level crystal reports version.

      Glad to listen to ur opinion on it.

      I spent quite some time and energy on Excel and used it a lot, but now I am focusing energy on BI software like crystal reports.

    • thundom says:

      We both know that based on the technology today. All the time we spend on the Macro and advanced function of Excel can be done easily with other softwares which costs only hundreds of bucks.

      • Hui... says:

        @Thondom
        I don't think Excel tries to be the solver of all problems
        It is a generic tool
        Which for about 95% of people will do what they want 95% of the time
        There will always be specifics where specific custom software will do better than Excel
        It is the commonness of Excel which means that I can send a model to you and it will work , most of the time, that is its strength, of course combined with its flexility in being able to be adapted to suit most needs

        • thundom says:

          Hi Hui,
          You are right.

          But,

          for the business and individual, who spend too much resource on Excel to meet their BI requirements and other processing requests.

          Should they open their eyes to other ways to do it, in this age? Especially for many people try too much time to process stuff with thousands lines of macro programming.

          It is just as when human being created gun fire, the martial arts would not be that effective.

          Ppl need to be prodent when they choose their solution.

          • Hi guys, I just came across your conversation. I have an example of BI vs. Excel stuff. Here in Russia there is an ERP-system called "1C". It became a defacto standart for accounting, planning and BI / analytics. It is positioned as a flexible and powerful system and it really is.
            But its reporting abilities aren't user-friendly (or maybe just not me-friendly).
            Many reports require programming and all those SQL things, so that is common for a company to have a couple of programmers who develop and code those reports.
            So the common solution is to export data to Excel and then process it to be more suitable for further analysis or reporting.
            Well, it's obviously not a rule of thumb that special BI software can outperform Excel in day-to-day routine.

  4. Tris says:

    Hi Chandoo, thanks for publishing great Excel information. Pardon the ignorance as I havent used Data Model nor PowerPivot. But having seen your video clip on PowerPivot, how does Data Model differ from PowerPivot - the "process" seems familiar? Have a great day! And Excel to new heights! Regards,

  5. Nolberto says:

    Excellent posting, some pride themselves for having sheets with thousands of formulas or complicated formulas, but in the end the important thing is to work as little as possible.

    • Oz says:

      @Nolberto let's not gloat yet. Some people are forced to have thousands of complicated formulas when they don't have the fancy tools. I'm sad for the 2003 users who have to use SUMPRODUCT when the rest of us have SUMIFS available.

      In the end, I think the important thing is clean, trustworthy data--however you arrive at it. People survived more than 300 years with slide rules and paper. No PowerPivot for the Wright Brothers.

  6. koi says:

    hi chandoo,

    i added 2 column into sales, 1st column vlookup customer ID to CUST sheet to get the male or female, then 2nd column vlookup Product ID to Product sheet to get the product name, then after that i make pivot table out of sales sheet.

    but then the result is really different from yours

    the purposes is just try to do the vlookup vs add to data model to see if they get same result

    thanks

  7. koi says:

    ups sorry, didnt see that you're filtering using slicer..then it is good now the result are same with less effort 🙂

    thanks

  8. SPrasad says:

    Hi Chandoo, .I am interested to know whether we can build a star schema or snow flake data models through relations in Excel? (trying to correlate with Qlikview)

    • Chandoo says:

      Hi there,

      You can create a Star schema for sure. Snow-flake is possible too. As long as all relationships are one to many (or one to one) anything is possible.

      • Nestavaro says:

        What if customer.profession change its value after sometime?
        Supposed we have monthly data for Sales. What if one customer is a doctor in Feb, then a pilot in October, for example?

        How to build data model for such that situation?

        Thank you.

  9. Raghavendra Shanbog says:

    Hello ,
    I find this option similar to that of MS Access.
    In MS Access as well we have relationship concept and once you create a relationship, you can start creating number of queries based on that.
    But MS Access is not so user friendly and basically its database. Good that we are getting those options/functions in Excel.
    Thanks for sharing this info.

    Regards,
    Raghavendra Shanbog

  10. What is star schema and snow flake.??? Can we have next article on that if it is useful for us???

  11. Roberto says:

    Hi there, can anyone help? I tried testing this out in Excel using two tables. When I go to the Data tab the Relationships button does not appear at all. I am using Microsoft version 14.0.4760.1000, Microsoft Office Professional Plus 2010. Does this version have this capability? Or is there an add-in required?

  12. […] even a layperson can perform if they have the almighty Excel 2010 and PowerPivot installed. Or Excel 2013′s Data Model, which lets you mash up data from Excel Tables and serve them up directly as PivotTables with not a […]

  13. Chandeep Chhabra says:

    Chandoo/Hui,

    The dates grouping feature does not seem to work in Data Model. Is that true or am I making a mistake somewhere?

  14. Jay says:

    I don't think this is really for "lookups"...

    Try creating a pivot with sale ID and customer name in row fields. It will give you ALL customer names per sale ID.

    You'd need to use RELATED function in a new column in powerpivot if you want something equivalent to "vlookup"

  15. Aslam says:

    Please explain the difference between data model and power pivot, the functions of both of them are different and similar
    thanks

  16. […] Handling large volumes of data in Excel—Since Excel 2013, the “Data Model” feature in Excel has provided support for larger volumes of data than the 1M row limit per worksheet. Data Model also embraces the Tables, Columns, Relationships representation as first-class objects, as well as delivering pre-built commonly used business scenarios like year-over-year growth or working with organizational hierarchies. For several customers, the headroom Data Model is sufficient for dealing with their own large data volumes. In addition to the product documentation, several of our MVPs have provided great content on Power Pivot and the Data Model. Here are a couple of articles from Rob Collie and Chandoo. […]

  17. Bernadette Savage says:

    I need to use a slicer to allow a user to select vendor by name. In the background, I need to obtain the vendor ID to link to multiple datasets where the name may not be spelled consistently. Any advice?

  18. Andrea says:

    I've tried this in Excel 2016. It works great.
    I can even create Cube Formulas on the Data model after I've inserted the pivot table.
    Just for the fun of it, I tried to see if I could do Cube Formulas without creating the pivot table in advance. I can define Cube members, but it seems as if the measure part is playing tricks on me.

    I can't get a Cube Value for Chocolates sold to Male customers.
    With the Pivot created the formula looks like this (and works fine)
    =CUBEVALUE("ThisWorkbookDataModel";"[Customer].[Gender].&[Male]";"[Product].[Category].&[Chocolates]";"[Measures].[Sum of Quantity]")

    Does anyone know how I can solve this, or am I asking the impossible?

  19. Kwabena Anaafi says:

    I want to see the video on this topic

  20. nestavaro says:

    What if customer.profession change its value after sometime?
    Supposed we have monthly data for Sales. What if one customer is a doctor in Feb, then a pilot in October, for example?

    How to build data model for such that situation?

    Thank you.

    • Chandoo says:

      In such case, you need to make relationships based on two columns. This kind of feature is not supported in Excel. You can use Power Query to merge tables based on multiple columns and return a consolidated giant table to Excel for reporting.

  21. nestavaro says:

    Is it able in MS Access?
    I have never used access before.

  22. faisal says:

    thanks chandooo your article is very helpfull for troubling peoples' especially in office environment under boss pressure.

  23. Ron says:

    Here is an introduction to PowerPivot.

    The link above is broken

  24. Venkatesh says:

    Hi. This has really taken my interest.. I have huge data tables to work with...and I use vlookup to fetch certain data. I have different data in different sheets...

    Like customer sales (customer code, product code,qty, piece rate, total amount, branch code) data in one sheet
    Branch details in another (branch code, branch address, state , region)
    Customer Geographical Data in third sheet (region, region name)
    Product details in fourth sheet (product code, product description and related)

    Now I use a vlookup to get branch name, state and product name respectively into my main sheet.

    Now what I want is

    customer code, product code,qty, piece rate, total amount, branch code) data in one sheet, branch address, state , region, region name, product description

    Can't his be done thru data model... I tried but it's not working... Eitherway, I will gonthru thr session on e again and give a try... Any help, is appreciated. Thankyou

  25. Achyutanand Khuntia says:

    Dear All,

    i am striving to do reverse relationship in Power pivot ,

    example : -

    1 - Data sheet
    2. - Source data

    step to stops - import first data sheet in power piovt and then source data , made relationship with both sheet , after created relationship i am able to do put related formula in source data sheet only (=releted('Source data'[Amount]), if i go to put formula in data sheet , parameter of Source data are not visible ,

    could someone educate me how can i do , and utilize related formula in data sheet.

Leave a Reply