Excel UNIQUE Function: Fix Array Errors When Shared
In this article
To prevent the UNIQUE function from turning into a static array or throwing a #SPILL! error when shared, you must ensure the recipient is using a version of Excel that supports Dynamic Arrays (Microsoft 365 or Excel 2021+) and that the destination cells are completely empty. If a user on an older version opens the file, the formula will not dynamically update and may appear as a static range or a #NAME? error because the function does not exist in their software version.
What You'll Need
- A Microsoft 365 subscription or Excel 2021 or newer for all users accessing the file.
- A dataset with duplicate values that needs to be filtered.
- An empty area of the worksheet (the "spill range") where the results can populate without obstruction.
- Internet connectivity if the file is shared via OneDrive or SharePoint for real-time co-authoring.
Step-by-Step
- Prepare Your Source Data: Ensure your data is organized in a clean column or a formal Excel Table. Using an Excel Table (Insert > Table) is highly recommended because it allows the UNIQUE function to use structured references. This means if you add new rows to your data, the UNIQUE array will automatically expand to include them without you having to manually update the cell range in the formula.
- Identify the Spill Area: Select a cell where you want the unique list to begin. Look at the cells below and to the right of this starting point. The UNIQUE function requires "breathing room." If there is any data, including a single space character or a hidden formula, in the path of the resulting list, Excel will return a #SPILL! error. Clear all cells in the potential output area to avoid this.
- Enter the UNIQUE Formula: In your chosen cell, type
=UNIQUE(. Then, highlight the range of cells containing the duplicates or click the column header of your Excel Table. Close the parenthesis)and press Enter. For example, if your data is in cells A2 through A100, your formula should be=UNIQUE(A2:A100). - Verify the Dynamic Array: Once you press Enter, you will see a thin blue border surrounding the results. This border indicates a Dynamic Array. You cannot edit individual cells within this blue border; any changes must be made to the source data or the original formula in the top-left cell.
- Combine with SORT for Better Sharing: When sharing a list with others, an unsorted unique list is often difficult to read. Wrap your formula in the SORT function:
=SORT(UNIQUE(A2:A100)). This ensures that every person who opens the shared file sees the data in a consistent, alphabetical, or numerical order. - Share via Cloud Storage: To maintain the dynamic nature of the array, upload the file to OneDrive or SharePoint. Use the Share button in the top right corner of the Excel window to invite collaborators. Sharing via a cloud link ensures that users are prompted to open the file in Excel for the Web or their desktop app, both of which support dynamic arrays.
- Test Compatibility: Before sending the file to a large group, verify the version of Excel your colleagues are using. If they are using Excel 2019 or older, the UNIQUE function will not work. In these cases, you must either convert the array to static values (Copy > Paste Values) or use the legacy "Remove Duplicates" tool under the Data tab, though this removes the automation.
Common Mistakes
One of the most frequent errors is attempting to manually type data into the middle of a spill range. Because the UNIQUE function "owns" the range of cells it occupies, any manual entry in those cells will break the array and trigger a #SPILL! error. Users often try to "fix" a specific value in the list by typing over it, not realizing they are blocking the entire function from calculating.
Another common mistake is using the UNIQUE function within an Excel Table. Dynamic arrays are not supported inside the structured rows of an Excel Table. If you try to place =UNIQUE() inside a table column, Excel will not allow the results to spill downward. You must place the formula in a cell outside the table boundaries.
Users also frequently forget to use absolute references (like $A$2:$A$100) when they are not using a formal Table. If they copy the UNIQUE formula to another cell, the reference shifts, leading to incorrect results or errors when the shared user tries to move the formula to a different part of the sheet.
Tips
To make your shared array even more powerful, combine UNIQUE with the FILTER function. For example, =UNIQUE(FILTER(A2:A100, B2:B100="Completed")) will create a unique list of items that only have a status of "Completed." This is incredibly useful for shared dashboards where different team members need to see unique categories based on specific criteria.
If you want to count how many unique items are in your list, do not count the cells manually. Instead, use the COUNTA function combined with the spill operator (#). If your UNIQUE formula is in cell D2, use =COUNTA(D2#). The hashtag tells Excel to count every cell that is currently part of the dynamic array, regardless of how long it grows or shrinks as data changes.
For better visual organization, apply Conditional Formatting to the spill range. While you cannot apply formatting to the "array" itself, you can apply it to the columns where the array resides. This ensures that as the list expands, the new entries automatically inherit the desired borders or shading.
Troubleshooting
If the formula returns #SPILL!, it means there is something in the way. Click the cell with the error; Excel will often highlight the obstructing cells with a dashed border. Go to those cells and press Delete. If the cells look empty, check for invisible characters or spaces. Once the path is clear, the array will automatically populate.
If the formula returns #NAME?, the person opening the file is using a version of Excel that does not recognize the UNIQUE function. This is common in Excel 2016 or 2019. The only solution is to have the user update their software or for the creator to replace the formula with a static list using the Data > Remove Duplicates feature.
If the array does not update when source data changes, check if your Calculation Options are set to Manual. Go to the Formulas tab > Calculation Options and ensure "Automatic" is selected. If it is set to Manual, the UNIQUE array will only refresh when you press F9.
If the shared user sees a static list of values instead of a formula, it is possible the file was saved in an older .xls format or that the sender used "Paste Values" before sharing. Ensure the file is saved as a .xlsx or .xlsm file to preserve the dynamic formula functionality.
Frequently Asked Questions
Can I use UNIQUE in Excel for the Web?
Yes, the UNIQUE function is fully supported in Excel for the Web. In fact, using the web version is often the safest way to ensure that collaborators with different desktop versions can still see the dynamic array working correctly.
Why does my UNIQUE list change order randomly?
The UNIQUE function returns items in the order they first appear in the source list. If the source data is re-sorted, the unique list will change its order. To prevent this, always wrap your formula in the SORT function.
Does the UNIQUE function work with multiple columns?
Yes. If you select a range of multiple columns (e.g., A2:B100), the UNIQUE function will return unique rows. It treats the combination of data across those columns as a single unique record.
Can I use UNIQUE with a Pivot Table?
While you cannot put a UNIQUE formula inside a Pivot Table, you can use a UNIQUE array as the source data for a Pivot Table or use the Pivot Table's own "Row Labels" to achieve a similar unique listing effect.
What happens if the source data is empty?
If the range referenced by the UNIQUE function is entirely empty, it will return a #CALC! error. To avoid this, you can wrap the formula in an IFERROR function, such as =IFERROR(UNIQUE(A2:A100), "No Data").