• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Hash Sign in Excel Formulas

You are here: Home / Excel Formulas / Hash Sign in Excel Formulas
Excel Hash Spill Operator
October 21, 2021 by Mynda Treacy

If you’ve worked with dynamic array formulas*, you’ll have noticed that they’re able to spill the results to multiple cells. For example, in the image below we can see the UNIQUE function has spilled the results to cells G3:G6 which are highlighted with a blue border:

 

Excel Spilled Array

With the hash sign in Excel formulas we can easily reference that spilled range by appending it to the first cell reference for the range like so:

Hash Sign in Excel Formulas to reference Spilled Arrays

This is easier to write, but more importantly it’s dynamic. For example, if the category in cell C13 is changed to ‘Parts’, we now have 5 different categories and without having to update any formulas, they automatically update:

dynamic update to Spilled Array references

Fun fact, the official name for the hash sign is Octothorpe (thanks to Roger Govier for that fun fact). In Excel it's referred to as the Spill Operator as it enables us to reference spilled arrays.

*Note: Dynamic array formulas are available in Excel 2021 and Microsoft 365.

Watch the Video

Subscribe YouTube
 

Download Workbook

Enter your email address below to download the sample workbook.

By submitting your email address you agree that we can email you our Excel newsletter.
Please enter a valid email address.

Download the Excel Workbook and follow along. Note: This is a .xlsx file please ensure your browser doesn't change the file extension on download.

Excel # Spill Operator Examples

Let’s say I want to create dependent data validation lists for the Category and Products like this:

dependent data validation

The data validation list requires a reference to cells, or a formula that returns a cell reference:

data validation requires reference

Therefore, I can’t use a dynamic array formula directly inside the data validation dialog box to return the list. Instead, I need a table containing the different products in lists by category. I can use TRANSPOSE with UNIQUE for the column headers containing the categories, and FILTER for the product lists:

extract data for data validation

Note: the filter formula in cell G18 is copied to columns H:N to allow for growth in the number of categories.

Now that I have the table for each category and its products, I can reference this in my data validation lists.

Referencing Spilled Arrays in Data Validation

Because the table above contains spilled arrays, I can use the # operator to reference them ensuring I always pick up any changes to the table.

Category Data Validation List: To set up the data validation list for the Categories I can reference cell G17# in the data validation list dialog box:

excel hash sign in cell reference

If I add any more categories to the table, the data validation list will automatically include them.

I’ve inserted the data validation list in cell C17:

data validation

Now I need the dependent data validation list for the Products.

Referencing Spilled Arrays with Dynamic Named Ranges

Product Data Validation List: The dependent data validation list needs to lookup the category selected in cell C17 and return the relevant list of products. I’ll use the XLOOKUP function to return the reference to the product list.

The trick here is to reference the first row of the FILTER results in row 18 and append the spill operator to the end of the formula:

=XLOOKUP(C17,$G$17:$N$17,$G$18:$N$18)#

I can use this formula in a cell, and it spills the results:

xlookup with excel hash sign

Or, because XLOOKUP returns a reference, I can alternatively use this formula in my data validation list source:

xlookup with hash sign for data validation

This returns the products that spill from the FILTER formulas in row 18.

data validation

Note: You might be wondering why in the XLOOKUP formula I haven’t referenced the spilled array in G17 like this:

=XLOOKUP(C17,$G$17#,$G$18:$N$18)#

And that’s because if the size of the list of categories changes the return array will be the wrong size and the formula will return an error.

Instead, I’m referencing G17:N17 which also allows me to lookup out to column N allowing for growth in the list of categories. Obviously, you can extend this further than column N to allow for even more growth.

Cool Trick with Defined Names

Another way we can use the # spill operator is by appending it to a defined name. For example, we can define a name for the Products using an XLOOKUP formula with or without the #. I’ll define it without the #:

defined name with hash sign

If we look at this name in a formula you can see it returns the first item in the spilled array:

defined name formula

But when we append the spill operator to the name, we get the spilled array:

excel hash sign appended to defined name

Therefore, in the data validation list we can also access the spilled arrays by appending # to the defined name:

excel hash sign appended to defined name in data validation list

The purpose of this tutorial is to illustrate the different ways we can use the spill operator. There’s no benefits either way, it’s really what you’re most comfortable working with.

More Dynamic Arrays

If you'd like to get up to speed with dynamic arrays, please consider my Advanced Formulas Course.

Excel Hash Spill Operator
Mynda Treacy

Microsoft MVP logo

AUTHOR Mynda Treacy Co-Founder / Owner at My Online Training Hub

CIMA qualified Accountant with over 25 years experience in roles such as Global IT Financial Controller for investment banking firms Barclays Capital and NatWest Markets.

Mynda has been awarded Microsoft MVP status every year since 2014 for her expertise and contributions to educating people about Microsoft Excel.

Mynda teaches several courses here at MOTH including Excel Expert, Excel Dashboards, Power BI, Power Query and Power Pivot.

More Excel Formulas Posts

Summarize Months to Quarters

Excel Formulas to Summarise Monthly Data into Quarters

3 ways (good, better, best) to summarize monthly data into quarters using formulas. Lots of examples and sample file to download.
Excel BYROW and BYCOL Functions

Excel BYCOL and BYROW Functions

Excel BYCOL and BYROW functions fundamentally change the way we write formulas that calculate across columns and down rows.
python in excel natively

How to Use Python in Excel Natively

How to use Python in Excel natively using libraries like Pandas, NumPy, Matplotlib, Seaborn and more for analysis and spectacular charts!
excel dynamic named ranges

Excel Dynamic Named Ranges

Excel Dynamic Named Ranges update automatically to include new data in the ranges referenced in your formulas and PivotTables etc.
functions for financial modelling

Excel Functions for Financial Modeling

Top 23 must know Excel functions for Financial Modeling. Includes example Excel file and step by step instructions.
excel formula by example

Excel Formula by Example

Excel can now write a formula by example. Simply give it an example or two of the result and Excel will write the formula.
ai-aided excel formula editor

AI Aided Excel Formula Editor

Save time with this free AI Excel formula editor add-in that writes, edits, improves and interprets formulas for you!
top excel functions for data analysts

Top Excel Functions for Data Analysts

Must know Excel Functions for Data Analysts and what functions you don’t have to waste time learning and why.
excel advanced formula environment

Excel Labs (Formerly, Advanced Formula Environment)

Excel Labs is a long awaited, new improved way to write, name and store Excel formulas, including LAMBDAS with the help of AI.
Pro Excel Formula Writing Tips

Pro Excel Formula Writing Tips

Must know Excel formula writing tips, tricks and tools to make you an Excel formula ninja, including a new formula editor.


Category: Excel Formulas
Previous Post:pivot unknown variable number of rows to columnsPivot an Unknown Number of Rows into Columns
Next Post:Tips for Using The Power Query Advanced Editorpower query advanced editor tips

Reader Interactions

Comments

  1. John Atamanczyk

    October 30, 2021 at 5:01 am

    As always, thank you for the awesome tutorial! I thought it would be cool if the formula were to be enhanced to make it a little more dynamic.

    You addressed why this formula: =XLOOKUP(C17,G17:N17,G18:N18)# used the G17:N17 lookup range as opposed to using G17 with the spill operator, like in this formula: =XLOOKUP(C17,G17#,G18:N18)#. Since the issue is with the return array, I tried to construct that by counting how many items are in the spilled array and then using the ADDRESS function for the last item in the spilled array nested in an INDIRECT to return the range to the XLOOKUP, like so: =XLOOKUP(C17,G17#,INDIRECT(“G18:”&ADDRESS(18,6+COUNTA(G17#),,1)))#. Then I realized it could be tidied up a bit with OFFSET, like so: =XLOOKUP(C17,G17#,OFFSET(G18,0,0,,COUNTA(G17#)))#.

    Certainly, the solution you provided is the simplest. But I am wondering if you see any other downsides to implementing one of these next-level formulas? … I know some people prefer to avoid INDIRECT due to its volatility.

    Reply
    • Mynda Treacy

      October 30, 2021 at 10:17 am

      Great ideas, John. Someone else also shared the OFFSET solution on my YouTube channel. I prefer that to INDIRECT although they’re both volatile, which is fine as long as there aren’t loads of them in your file.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Current ye@r *

Leave this field empty

Sidebar

More results...

Popular Content

  • 10 Common Excel Mistakes to Avoid
  • Top Excel Functions for Data Analysts
  • Secrets to Building Excel Dashboards in Less Than 15 Minutes
  • Pro Excel Formula Writing Tips
  • Hidden Excel Double-Click Shortcuts
  • Top 10 Intermediate Excel Functions
  • 5 Pro Excel Dashboard Design Tips
  • 5 Excel SUM Function Tricks
  • 239 Excel Keyboard Shortcuts

100 Excel Tips and Tricks eBook

Download Free Tips & Tricks

239 Excel Keyboard Shortcuts

Download Free PDF

mynda treacy microsoft mvpHi, I'm Mynda Treacy and I run MOTH with my husband, Phil. Through our blog, webinars, YouTube channel and courses we hope we can help you learn Excel, Power Pivot and DAX, Power Query, Power BI, and Excel Dashboards.

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk – For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.

Download A Free Copy of 100 Excel Tips & Tricks

excel tips and tricks ebook

We respect your privacy. We won’t spam you.

x