How to Unique Values From Multiple Ranges in Excel
Learn multiple Excel methods to pull a single list of unique values from multiple ranges with step-by-step examples and practical applications.
How to Unique Values From Multiple Ranges in Excel
Why This Task Matters in Excel
When data is scattered across several worksheets or tables, analysts often need a consolidated list that shows each item only once. Imagine a sales organization that tracks leads by region in separate sheets: East, West, and International. Management wants one master list of clients without duplicates so they can run company-wide campaigns or measure total reach. Pulling unique values from multiple ranges turns siloed data into a unified source of truth.
This need appears in nearly every industry. Human resources groups merge employee IDs from regional payroll files. Finance teams reconcile vendor codes stored in separate departmental trackers. Marketing teams combine email lists gathered from conferences, webinars, and web sign-ups. In each scenario, duplicates inflate counts, distort dashboards, and raise the risk of contacting the same customer twice. By generating a clean, deduplicated list, professionals maintain data integrity, avoid embarrassment, and base decisions on accurate counts.
Excel is ideally suited for this job because it offers both formula-based and no-code methods. Dynamic array functions such as VSTACK, HSTACK, and UNIQUE in Microsoft 365 let you combine and de-duplicate five thousand records in a single “live” formula that updates whenever source data changes. Earlier versions can achieve the same result through established techniques like Power Query or Advanced Filter. Not knowing how to create a unified unique list often forces people to copy-paste, run Remove Duplicates, or manipulate CSV files—time-consuming steps that break automation and introduce errors. Mastering this task therefore unlocks cleaner data flows, faster reporting cycles, and smoother collaboration with other analytics tools such as Power BI and Tableau.
Best Excel Approach
The most efficient modern solution is to vertically stack the source ranges into one virtual column and then run UNIQUE on that combined array. In Microsoft 365 or Excel 2021, VSTACK is perfect for vertical concatenation, while HSTACK can combine horizontal ranges. Once the data sits in a single array, UNIQUE removes duplicates automatically.
Recommended syntax:
=UNIQUE(VSTACK(Sheet1!A2:A100,Sheet2!B2:B80,Sheet3!C2:C60))
Why this is best:
- Dynamic: Any addition or removal in the source ranges flows straight into the results without manual refresh.
- Concise: One formula replaces five to ten intermediate steps.
- Versatile: Works equally well on numbers, text, dates, or mixed data types.
- Spill-friendly: The final list “spills” downward to exactly as many rows as needed.
Use this method when you are on Microsoft 365/2021 and your data is structured in consistent columns. If you are limited to Excel 2019 or older, jump to Power Query or Advanced Filter (covered later). Prerequisites are simply having each source list in a contiguous column or row without blank cells inside the active range. The logic is: 1) stack, 2) de-duplicate.
Alternative formula when some ranges run horizontally:
=UNIQUE(TOCOL(CHOOSECOLS({Sheet1!A2:G2;Sheet2!A3:G3;Sheet3!A4:G4},1)))
Here TOCOL converts multi-column data to a single column before UNIQUE deduplicates.
Parameters and Inputs
- Source ranges: These are the actual cells that hold your data, e.g., [A2:A100]. They can reside in the same sheet or different sheets and even different workbooks (if open). Data type can be text, numbers, or dates.
- Function arguments:
- VSTACK(range1,range2,…): Accepts any number of ranges as positional arguments. All must contain the same number of columns.
- HSTACK(range1,range2,…): Same idea but for horizontal stacking (must share row count).
- UNIQUE(array,[by_col],[exactly_once]):
– array: required.
– by_col: optional TRUE/FALSE to compare across rows instead of columns. Usually FALSE.
– exactly_once: optional TRUE/FALSE to return values that appear only once as opposed to at least once.
- Data preparation: Ensure there are no leading/trailing spaces, mismatched data types (e.g., text \"123\" next to numeric 123), or blank rows that you don’t want included.
- Edge cases:
- Empty cells—UNIQUE ignores blanks by default.
- Mixed numbers and text that look similar—UNIQUE treats the text \"100\" as different from the number 100.
- Case sensitivity—UNIQUE is not case-sensitive for text comparisons.
- Validation: Confirm that columns line up when using VSTACK. Mismatched widths trigger #N/A errors. If widths differ, use CHOOSECOLS or TAKE to standardize.
Step-by-Step Examples
Example 1: Basic Scenario
Suppose you have three small lists of project codes located in one worksheet:
- [A2:A7] = PRJ-001 … PRJ-006
- [B2:B6] = PRJ-003 … PRJ-007
- [C2:C5] = PRJ-002 … PRJ-008
Goal: produce a single column of codes appearing at least once.
- Click cell E2 where you want the unique list to begin.
- Enter:
=UNIQUE(VSTACK(A2:A7,B2:B6,C2:C5))
- Press Enter. Excel spills the result down column E, returning PRJ-001, PRJ-002, … PRJ-008 with no duplicates.
- Confirm that adding PRJ-009 to any source list immediately appends it below the existing spill range, proving the formula’s dynamic nature.
Why it works: VSTACK piles each column on top of the next, making an internal array with sixteen rows. UNIQUE scans that array row by row, flagging the first occurrence of each code and omitting subsequent repeats. There is no need for sorting first; however, if you want alphabetical order, wrap SORT:
=SORT(UNIQUE(VSTACK(A2:A7,B2:B6,C2:C5)))
Troubleshooting: If you get #REF! and a message about overlapping ranges, ensure the spill area (E2 downward) is empty. Move the formula to a new column if necessary.
Variations: Stacking rows instead of columns requires HSTACK and possibly TOCOL:
=UNIQUE(TOCOL(HSTACK(A2:G2,A3:G3,A4:G4),1))
Example 2: Real-World Application
Scenario: A retail company keeps a list of loyalty-program emails by channel. Column A in Sheet “In-Store” holds emails gathered at the point of sale. Column B in Sheet “Online Orders” stores emails collected at checkout. Column C in Sheet “Events” lists emails scanned from QR codes at pop-up booths. Management wants a master email list for a new marketing campaign.
Step-by-step:
- Validate each source range for accidental spaces: in a blank column, test
=LEN(A2)-LEN(TRIM(A2)). Non-zero results reveal trailing spaces that you should clean via TRIM or Power Query. - On a new sheet named “Master Email List”, click cell A2.
- Type:
=SORT(UNIQUE(VSTACK('In-Store'!A2:A10000,'Online Orders'!B2:B20000,'Events'!C2:C5000)))
- Press Enter. Excel may take a moment if you stack more than 35,000 records, then produce a deduplicated, alphabetically sorted column.
- Optional: Apply Data ▶ Data Validation to disallow blanks in the source columns going forward (Settings: Allow = Custom, Formula =
=LEN(TRIM(A2))>0). - Integrate with a marketing platform using ODBC or “Get Data”. Because the output is a normal range that resizes automatically, you only need to point your external tool at a named range attached to A2# (the hash symbol references the entire spill range).
Benefits: Marketing now emails every unique customer once, improving open rates and reducing spam flags. If a customer unsubscribes via the store channel and their email remains online, the deduplicated list still contains only one record, which you can tag with status columns appended next to the spill result.
Performance considerations: On slower machines, the formula may recalculate each time an email is added. To minimize recalculations, turn on “Manual calculation” during bulk data loads, then press F9 when ready.
Example 3: Advanced Technique
Edge case: You need only values that appear in exactly one of the source lists (no overlaps). This is critical when identifying prospects captured exclusively through a given campaign to measure incremental reach.
Source:
- Sheet1!A2:A15 (Campaign A)
- Sheet2!A2:A15 (Campaign B)
- Sheet3!A2:A15 (Campaign C)
Procedure:
- Combine all three ranges:
=VSTACK(Sheet1!A2:A15,Sheet2!A2:A15,Sheet3!A2:A15)
- Inside UNIQUE, set the third argument (exactly_once) to TRUE:
=UNIQUE(VSTACK(Sheet1!A2:A15,Sheet2!A2:A15,Sheet3!A2:A15),FALSE,TRUE)
The result returns only emails present in one list but not the others.
- Add a column beside the spill to indicate which campaign produced the exclusive lead. Use XLOOKUP with nested IFERROR:
=LET(
u,A2#,
IFERROR(XLOOKUP(u,Sheet1!A2:A15,Sheet1!B2:B15),"") &
IFERROR(XLOOKUP(u,Sheet2!A2:A15,Sheet2!B2:B15),"") &
IFERROR(XLOOKUP(u,Sheet3!A2:A15,Sheet3!B2:B15),"")
)
This returns campaign codes where a match occurs. Since each email appears only once overall, exactly one lookup succeeds.
Optimization tips: Wrap the VSTACK in a LET statement to avoid recalculating it multiple times inside more complex formulas. Example:
=LET(
allData,VSTACK(Sheet1!A2:A15,Sheet2!A2:A15,Sheet3!A2:A15),
UNIQUE(allData,FALSE,TRUE)
)
Professional insights:
- Use dynamic named ranges to refer to new campaigns without editing the core formula.
- For millions of rows, off-load the heavy lifting to Power Query or a SQL backend, then surface a summarized list in Excel.
Tips and Best Practices
- Name spill ranges: Select the cell containing your UNIQUE formula, then type a name like MasterCodes in the Name Box. Any connected charts or pivot tables auto-expand.
- Use LET to store intermediate arrays, reducing calculation time, especially when you nest UNIQUE inside other functions such as SORTBY or FILTER.
- Keep source lists in tables (Ctrl+T). Structured references pass automatically into formulas and grow when new items are added.
- Remove extraneous spaces and inconsistent casing first. UNIQUE treats \"apple\" and \"Apple\" as equal, but data hygiene speeds later merges.
- For vertical and horizontal mixes, standardize with TOCOL or TOROW before de-duplication.
- Document formulas with cell comments or the Formula Text function so colleagues understand the data flow.
Common Mistakes to Avoid
- Mismatched column counts with VSTACK or row counts with HSTACK, leading to #N/A errors. Fix by using CHOOSECOLS to align columns.
- Placing the UNIQUE formula where spill rows collide with existing data, causing #SPILL! errors. Always leave enough blank rows below, or move the formula to a separate sheet.
- Forgetting to convert numbers stored as text, which produces duplicated numeric IDs (e.g., 100 vs \"100\"). Use VALUE or multiply by 1 to normalize.
- Hard-coding ranges like [A2:A100] that may miss new entries beyond row 100. Wrap the column in a table or use the whole column reference [A:A] if performance tolerates it.
- Attempting to refresh formulas in large files on Automatic calculation while still typing. Switch to Manual mode, then calculate once when editing is complete.
Alternative Methods
| Method | Excel Version | Pros | Cons | Use When |
|---|---|---|---|---|
| VSTACK + UNIQUE | 365 / 2021 | One cell, dynamic, fast | Requires modern Excel | Default choice |
| Power Query | 2010+ (with add-in) | Handles millions of rows, GUI | Needs refresh, not live in formula | Large datasets, older versions |
| Advanced Filter | 2007+ | No formulas, quick one-off | Manual steps, not dynamic | Occasional tasks |
| INDEX/MATCH with FREQUENCY | Any | Formula-based, compatible | Complex, volatile, resource heavy | When macros disabled and no Power Query |
| PivotTable (Row field, set to \"Tabular\", remove subtotals) | 2007+ | Familiar to many users | Requires refresh, list not editable directly | Quick dedup lists for reporting |
Choose Power Query when combining files too large for the worksheet grid or when you need to do additional transformations such as changing data types, merging columns, or performing fuzzy matching. Use Advanced Filter if you need a static deduped list for a one-time mail merge and you are comfortable with manual commands.
FAQ
When should I use this approach?
Use VSTACK + UNIQUE when your data is already inside Excel, you have Microsoft 365/2021 or later, and you need the result to update automatically every time another entry is added to any source list. It is ideal for ongoing dashboards, master data management, and dynamic lookups.
Can this work across multiple sheets?
Yes. Reference each sheet explicitly in the VSTACK arguments, for example VSTACK(Sheet1!A:A,Sheet2!A:A). If ranges reside in closed workbooks, open them first or use Power Query’s “Combine Files” connector.
What are the limitations?
Dynamic arrays spill in one direction only, so the result must have empty cells below (or beside for horizontal spills). UNIQUE is limited to 1,048,576 results (Excel’s row limit). Case sensitivity cannot be enabled directly; you would need FILTER with EXACT for that behavior.
How do I handle errors?
Wrap your formula in IFERROR to trap problems: =IFERROR(UNIQUE(VSTACK(...)),"Data issue"). Resolve #N/A by ensuring columns align, #VALUE! by verifying data types, and #SPILL! by clearing the target area or moving the formula.
Does this work in older Excel versions?
VSTACK and UNIQUE do not exist in Excel 2019 or earlier. Use Power Query (Data ▶ Get & Transform) or the legacy Advanced Filter with the “Unique records only” option. Alternatively, array formulas with FREQUENCY or COUNTIF can emulate UNIQUE but are less efficient.
What about performance with large datasets?
For 100,000 rows or more, formulas calculate quickly, but sorting can slow down if you wrap SORT. To optimize, store the stacked array in LET, avoid volatile functions, and consider Power Query if the workbook becomes sluggish. Excel 64-bit handles larger datasets more comfortably.
Conclusion
Being able to pull a single, deduplicated list from several data ranges turns messy spreadsheets into reliable analytical assets. Whether you rely on VSTACK and UNIQUE in Microsoft 365 or alternative tools like Power Query, mastering this workflow streamlines reporting, improves data quality, and removes hours of manual reconciliation. Practice the examples in this guide, adapt the techniques to your own datasets, and you will unlock faster insights and greater confidence in your numbers—an essential milestone on your journey to Excel mastery.
Related Articles
How to Show the 10 Most Common Text Values in Excel
Learn multiple Excel methods to list the 10 most frequent text values—complete with step-by-step examples, business use cases, and expert tips.
How to Abbreviate Names Or Words in Excel
Learn multiple Excel methods to abbreviate names or words with step-by-step examples and practical applications.
How to Abbreviate State Names in Excel
Learn multiple Excel methods to abbreviate state names with step-by-step examples, professional tips, and real-world applications.