Software & Apps / Microsoft Excel / Data cleanup
Use Remove Duplicates when you intend to delete repeated records from a working copy. Use UNIQUE when you want a separate formula result while retaining the source data. Before either operation, define which columns identify a duplicate and what information must survive.
A repeated customer name is not necessarily a duplicate transaction. Two rows can describe the same customer and different orders, or the same order with conflicting details. Excel can apply a comparison rule, but you must decide whether that rule represents the business records correctly.
Do you need a list of distinct labels, one retained record per identifier, or only values that occur once? Those are different tasks. Keep an unchanged source and write the intended result down before changing the data.
01 / Compare an edit to the data with a separate result
Microsoft’s duplicate-removal guidance describes Remove Duplicates as deleting duplicate data and recommends preserving the original. UNIQUE, by contrast, returns an array of distinct rows or columns from the range supplied to it.
| Need | Starting option | Decision to make |
|---|---|---|
| Inspect repeated entries | Highlight duplicates. | Are the repetitions valid records? |
| Reduce a copied dataset | Remove Duplicates. | Which matching fields and retained record are correct? |
| Produce a separate list | UNIQUE. | Which range defines the result? |
| Find entries occurring once | UNIQUE with exactly_once enabled. | Do you really want to exclude every repeated value? |
For a report listing departments, a separate distinct list may be enough. For a contact import that must contain one approved record per customer, you need a rule for conflicting fields as well. A shorter list is not automatically a better dataset.
This guide uses Windows desktop Excel menu paths. The UNIQUE examples target versions listed in Microsoft’s current function documentation, including Microsoft 365, Excel 2024, and Excel 2021. Check function availability before building a workbook that someone else must maintain.
02 / Define what makes two records the same
Consider this small hypothetical dataset. It describes invented records, not a tested customer export:
| Customer ID | Order ID | Status |
|---|---|---|
| C101 | O501 | Open |
| C101 | O502 | Open |
| C101 | O501 | Open |
| C101 | O501 | Closed |
For an order-history task, customer ID alone is too broad: it would group different orders together. Customer ID plus order ID identifies a smaller group, but that group still contains conflicting statuses. Comparing every field distinguishes the closed record from the open record without deciding which reflects the current order state.
Write the matching rule in ordinary language. For example: “Only remove repeated copies with the same customer, order, and status.” If instead the requirement is “keep the current status per order,” establish how current is determined before proceeding.
Use a stable identifier where the source provides one. Names, abbreviations, and labels can change or be shared by several entities. Do not invent a reliable identity match from similar-looking text.
Keep rows with blank identifiers or contradictory fields in an exception review until their meaning is clear. Forcing them through the same rule merely to make a row count smaller can hide the very problems the cleanup should reveal.
03 / Use Remove Duplicates on a defined working copy
Microsoft’s detailed removal instructions explain that the selected comparison columns form the key. A matched record is removed across the selected range or table, including its other columns. The first occurrence is retained.
- Preserve the source, then work on a separately identified copy.
- Select the complete intended range or use the relevant table.
- Open Data > Remove Duplicates.
- Check the header interpretation and select only the columns in your matching rule.
- Confirm the operation, then inspect the remaining data.
The retained occurrence is not automatically the newest, most complete, or approved record. If conflicting records need a preference rule, resolve that deliberately. Do not assume row order expresses a trustworthy business priority.
Before deletion, Microsoft also documents Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values for inspecting repeated cells. A repeated value highlighted in one column still needs interpretation in the context of the full row.
Make sure every field belonging to a record stays associated with it during preparation. Sorting or editing one column in isolation is a poor way to decide which complete record should survive. If the dataset’s boundaries are unclear, fix the structure before attempting removal.
04 / Distinguish “distinct” from “occurs exactly once”
For a separate output, the basic syntax is UNIQUE(array,[by_col],[exactly_once]). Microsoft documents row comparison when by_col is omitted or FALSE. The last argument changes whether repeated values contribute one result or no result.
Suppose cells A2:A5 contain the invented labels North, North, South, West. These formula examples illustrate the documented difference:
=UNIQUE(A2:A5)
Result: North, South, West
=UNIQUE(A2:A5,FALSE,TRUE)
Result: South, WestThe second formula is not simply a stricter way to keep one copy. It excludes North because North appears more than once. Use that option only when the question is specifically about entries with one occurrence.
For distinct complete rows in the hypothetical table, supply the full data range, such as =UNIQUE(A2:C5). For a list of customer identifiers, supply the identifier column instead. Choosing the range defines what is compared; UNIQUE does not infer your record identity.
These examples use English function names and comma separators. Your regional Excel setup may use different separators. Keep the example small enough to inspect when adapting it to your workbook.
A distinct identifier list does not select the correct status or combine conflicting records. Keep that task separate rather than presenting a neat list of IDs as a completed reconciliation.
05 / Leave room for the formula result
Microsoft’s dynamic-array guidance explains that an array result fills neighboring cells. Place the formula outside an Excel table and leave the output area clear. If data blocks the result, Excel can return #SPILL!.
Inspect a blockage before removing anything. A nearby note or another report may be useful data, not disposable clutter. Move the output to a suitable location or preserve the obstructing content before changing the layout.
A table can still hold the source data. Structured references can adjust as table rows are added or removed, while the spilling formula sits outside it. Our Excel table vs range guide explains that source-structure decision.
Use explicit boundaries for a fixed-range example. If the real source later extends beyond those boundaries, the formula will need the corresponding update. A valid formula can return an incomplete report when its input no longer covers the intended records.
For workbook-to-workbook designs, Microsoft documents limited dynamic-array support that requires both workbooks to be open. Prefer a handoff design whose dependencies the recipient can understand and maintain.
06 / Investigate values that only look identical
When results look wrong, compare the actual source entries before changing the matching rule. Microsoft’s data-cleaning guidance identifies spaces, nonprinting characters, mixed data types, and imported dates as sources of unexpected behaviour.
Use helper columns for proposed normalization while preserving the originals. Record what each change means. Removing a formatting difference and changing an identifier are not interchangeable cleanup steps.
TRIM removes ordinary extra spaces, but Microsoft notes that it does not remove nonbreaking spaces by itself. It also reduces repeated ordinary spaces between words. Check whether that transformation is appropriate for the field before applying it everywhere.
A generic cleaning formula is not a complete identity policy. Product codes, account identifiers, and free-text descriptions can have different rules. Test representative awkward entries and compare the normalized output with the source.
If identifiers lost leading zeros during import, duplicate cleanup will not reconstruct the intended values. Our CSV import guide for preserving leading zeros addresses that earlier stage. Repair the import process or return to a reliable source instead of guessing which identifiers should match.
When two records share an identifier but disagree elsewhere, preserve the disagreement for review. Deleting one occurrence can make the sheet look cleaner while leaving the underlying decision unresolved.
07 / Verify what survived, not only how many rows remain
Use a small representative copy first. The following is a suggested review plan; no hands-on Excel test or performance benchmark was performed for this article.
- Confirm that the unchanged source remains available.
- Record the input range, comparison columns, and intended output.
- Check an exact repetition and a legitimate repeated identifier.
- Inspect conflicting fields and blank identifiers separately.
- Verify that retained values match the approved rule.
- Check the source boundary and spill area for formula output.
- Review downstream reports and totals affected by the change.
Microsoft notes that duplicate-removal counts can include empty cells or spaces. Treat the message as an operation summary, not proof that the correct business records survived.
For transaction data, explain any change to totals. Removing an accidentally imported transaction twice should have an understood effect. Removing a valid repeat purchase because its customer ID matched is a different outcome. A row-count reduction alone cannot distinguish them.
When the cleanup recurs, keep the rule and exception handling with the workbook’s instructions. The next person should be able to explain which records were grouped and why, without reverse-engineering a one-time result.
Frequently asked questions
Which option is safer for a first look?
Preserve the source and inspect the candidate matches. A separate result is useful for review before committing to deletion.
Does selecting every column always give the right answer?
No. It defines a full-record comparison, which may differ from your business identity rule. Establish the purpose before choosing the fields.
Will a distinct customer list keep the latest order status?
No. A label list and a rule for retaining the current record are different outputs. Resolve conflicting records separately.
Should I ignore a spill error if the formula looks correct?
No. Inspect the output location and source references. A formula that cannot produce its result is not a completed report.
Sources and scope
Microsoft Support documentation was checked on 28 October 2026. Formula examples and order records are illustrative. Confirm function support and interface labels in your Excel version, and verify the intended record rules before changing real data.



Add comment