Q

Dynamic Array Function Screenshot

Overview

Have you used any of Excel’s dynamic array functions (DAFs) yet?  If not, you’re missing out on possibly the biggest update to Excel, possibly ever.  Even though they’ve been around for a few years (launching in 2018), it seems like only advanced users have worked them into their routine toolsets.  The biggest benefit of DAFs is the ability to return multiple cell values that spill across multiple cells (hence the “dynamic” in the name).

DAFs can completely change your Excel approach – in a positive way.  In this article, we’ll discuss what DAFs are, why you should use them, some tips and gotchas, some DAF combination formula examples, and a few macros that make them even quicker and easier to use.

What are DAFs?

DAFs are functions that can natively return arrays of cells or values.  Those cells or values can then feed into other functions or spill the values across multiple cells down or to the right.  Because they are formula-driven, they can update automatically, expanding or contracting as the referenced source data changes (see how the values spill in this screenshot 🖼️). Without DAFs, you’re left to manually fill formulas or use macros to accommodate the number of rows/columns your source data contains – often forgotten steps.  But DAFs can be built to work with variable numbers of rows and columns. With those, you can filter, sort, transpose, combine, split, remove duplicates, and all sorts of other data transformations.  And when you use the LAMBDA and LET functions, you can combine all these approaches in one epic formula!

Why should you use DAFs?

There are several key reasons to use DAFs:

  • They make it easy to work with arrays, a concept that most users seem to be scared of.  Working with arrays is possible without DAFs, but it’s quite a bit more difficult and not nearly as flexible.
  • They bring together complex calculations in a single formula rather than splitting them into separate formulas or columns.  When defining them with a custom LAMBDA formula, you can then use them all throughout your workbook and just tweak the LAMBDA formula in one place.
  • They reduce error risk by consolidating several steps into one formula.  The more formulas you have, the greater the chance of errors from typing or copying and pasting them.
  • They automatically expand and contract based on your source data.  This is huge because it puts the dynamic in DAFs!

Tips & tricks

Here are several tips to help you use DAFs more effectively:

  • CHOOSE, INDEX, and SEQUENCE are extremely useful functions to use within spilling formulas.
  • UNIQUE, FILTER, and SORT are useful for manipulating the data within your spilling formulas.
  • Use the #hashtag character to refer to an entire spilled range instead of just one cell (i.e. reference B2# instead of just B2).
  • Combine the #hashtag with the : (colon – which means union in Excel) to include other cells like headers (i.e. A2#:A1).
  • When you select a cell within a spilled range, you’ll see a blue border around that spilled range. If you’ve selected any cell other than the top-left cell in the spilled range, the formula will be grey (the top-left one will still be black).
  • Many non-DAF formulas can also now spill when you supply a range of cells as an argument (i.e. LEN(A2:A20)).

Gotchas

Be aware of several gotchas related to DAFs:

  • If your data is spilling down and/or right and there is a cell value within the spill path, Excel will return the #SPILL error.  Update the spilling formula or clear the cell values in the spill path to fix it.
  • If spilling is not working as intended, check your version of Excel. If it’s older than 2018, it probably doesn’t support DAFs and spilling.
  • DAFs don’t work within tables.  Tables are often the source references for extensive DAF formulas.
  • DAFs don’t play nicely with traditional sorting and filtering (leave those to the source data your DAFs refer to!).

DAF combination examples

DAFs are even more powerful when you combine them together with other DAFs and non-DAF formulas.  Here are a few examples:

CHOOSE, UNIQUE, and SUMIFS

Formula: =CHOOSE({1,2},UNIQUE(A3:A10),SUMIFS(B3:B10,A3:A10,UNIQUE(A3:A10)))

SORT, UNIQUE, and FILTER

Formula: =SORT(UNIQUE(FILTER(A3:A27,B3:B27>=140000)),1)

TEXTSPLIT and TEXTJOIN

Formula: =TEXTSPLIT(TEXTJOIN(“|”,TRUE,A4:A5000),”, “,”|”,,,””)

EOMONTH and SEQUENCE

Formula: =EOMONTH(“12/31/2023”, SEQUENCE(,6,0,-1))

SEQUENCE and COUNTA

Formula: =SEQUENCE(COUNTA($B$2:$B$1502))

Macros that help

The XLEV8 Excel Add-in contains several macros that help you work more efficiently with DAFs:

  • Toggle Spilled Formula – this lets you convert a variety of formulas into dynamic, spilling formulas and back to non-spilling again.
  • Insert Counter Formula – this lets you insert a dynamic counter formula that expands with data to the right..
  • Toggle Lookup – this lets you toggle between VLOOKUP, INDEX/MATCH, and XLOOKUP (generally the best option for spilling!).

Summary

If you want to make your files extremely dynamic with the most modern approach in Excel, DAFs are a great option.  They work well together and with other Excel tools like Power Query and VBA.  Use the tips, gotchas, and examples above to get started with them and take your Excel skills to a whole new level!

Have you used DAFs extensively in Excel?  Any additional tips or tricks to share?  Let us know in the comments below!

Don't miss great tips, tricks, news, and events!

  • Get our 53 Time Hacks e-book (or other resource) free!
  • Get weekly insights and news
  • Valuable time-saving best practices
  • Unlock exclusive resources

Almost there! We just need to confirm the email address is yours. Please check your email for a confirmation message.