Yes. In Excel for Microsoft 365 on Windows, immediately press Ctrl+Z after using Remove Duplicates, or click Undo on the Quick Access Toolbar; on a Mac, press Command+Z. Excel normally restores the rows it removed, but if you have closed the workbook or the undo history is no longer available, you may need to recover an earlier version or rebuild the data from another copy.
Undo the removal immediately
Remove Duplicates is usually treated as a single undoable action. If it was the last change, Ctrl+Z should bring the removed records back. On Windows, you can also click the left-curving Undo arrow near the top of the Excel window. On Mac, use Command+Z or the Undo command. In Excel for the web, use the Undo control or the keyboard shortcut supported by your browser and system.
If you made other changes afterward, Excel generally undoes the most recent action first. Press the shortcut repeatedly, checking the sheet after each step, until the duplicate-removal operation is reversed. This also reverses the intervening actions, so pause if you see a change you want to keep. The Undo arrow may show the action that will be undone; its drop-down can show a list of recent actions, although undoing several actions in one selection reverses them together.
- Stop editing the workbook as soon as you notice the mistake.
- Press Ctrl+Z on Windows or Command+Z on Mac once.
- Check that the missing records have returned and that the rest of the table is still aligned.
- If the removal is not reversed, check whether a later action must be undone first, then consider the recovery options below.
Undo history is temporary, not a permanent record of every version of a workbook. Closing and reopening a workbook generally leaves you without the previous editing session’s undo history. Saving by itself does not always immediately remove the ability to undo, so if the workbook is still open, try Undo before assuming the data is lost.
What Remove Duplicates changes
On Windows, select a cell in the data range and choose Data > Data Tools > Remove Duplicates. In the dialog, select the columns Excel should use to decide whether records are duplicates. If the first row contains headings, leave My data has headers selected. Excel keeps the first matching record in the current order and removes subsequent records that match the chosen columns.
For example, a table might contain customer ID, name, and email address. If you select only Customer ID in the dialog, records with the same ID count as duplicates even if their names or email addresses differ. If you select all three columns, Excel removes only rows where all three selected values match. The choice of columns therefore matters as much as the command itself.
Remove Duplicates changes the selected data; it is not merely a visual filter. If Excel removes rows from a table, those records disappear from that table until you undo or recover them. The command does not create a separate list of the deleted records. The dialog reports how many duplicate values were found and how many unique values remain, but that message is not a recovery copy.
Be careful if the records sit beside other data that is not part of the selected range. When Excel asks whether to expand the selection, choosing the full related table is usually the safer option. If you continue with only a narrow selection, you risk removing cells without removing their associated information in neighboring columns. In a properly structured table, select the table as a whole and use the relevant columns only to define what counts as a duplicate.
If Ctrl+Z no longer works
First, do not make more changes than necessary. Additional edits can make it harder to identify what is missing and may complicate recovery. If the workbook is open, inspect the Undo arrow and try undoing later actions one at a time. Some operations, such as running a macro, can clear Excel’s undo history, and closing and reopening the file usually ends the opportunity to undo actions from the earlier session.
If the workbook is stored in OneDrive or SharePoint, check its version history. In Excel for Windows, look under File > Info > Version History when that option is available. You can also find version history through the file’s name or its storage location, depending on how you opened it. Open an earlier version and compare it with the current workbook before restoring anything. Restoring a version can replace newer changes, so preserve a copy of the current file first if it contains work you still need.
For a file saved locally, check whether you have a separate backup, an emailed attachment, or a copy in another folder. Windows backup or organizational backup systems may also have an earlier file version, depending on how they are configured. Excel’s AutoRecover is mainly intended to help after an unexpected close; it should not be treated as a guaranteed archive of every earlier state. Recovery choices depend on where the workbook is saved and which backup features were enabled.
If no undo history, version, or backup contains the records, Excel may not be able to recreate the deleted rows automatically. You may need to obtain the original data again from its source, such as a downloaded report, database, or system export. Avoid saving over the only remaining copy while investigating. Making a separate copy first gives you a safer place to test recovery steps.
Power Query offers a reversible alternative
If your goal is to produce a clean list without changing the source table, Power Query is often a better fit than deleting records directly. In Excel for Microsoft 365, load or select the data and open it in Power Query Editor. In the editor, select the columns that define a duplicate, then choose Home > Remove Rows > Remove Duplicates. When you close and load the query, Excel returns the transformed result while the original source data remains available.
Power Query records transformations as applied steps. To change the deduplication later, select the query and reopen it for editing. In Query Settings, you can remove or modify the relevant step, then refresh or load the revised result. This is different from Ctrl+Z: the query remembers the transformation as part of its definition, so you can adjust the process after the original editing session has ended.
There are still details to check. Power Query uses the selected columns to determine duplicates, so selecting too few columns can combine records that should remain distinct. Also, the result may change when the query is refreshed because the source data may have changed. Keep the source intact and verify the columns and row counts before relying on the output.
Use a formula or filter when you need a separate result
A dynamic array formula can return a distinct list while leaving the source untouched. With names in A2:A8 and an empty output area beginning in C2, enter =UNIQUE(A2:A8) in C2. If the source contains Alex, Bea, Alex, Chen, Bea, the spilled result is Alex, Bea, Chen, in first-seen order. The formula does not delete or alter the original entries. UNIQUE is available in Microsoft 365 and Excel 2021 or later; ensure the cells below the formula are clear so the result can spill.
For records with several fields, UNIQUE can return distinct rows across the selected columns. With records in A2:C20 and an empty output area beginning in E2, =UNIQUE(A2:C20) returns rows that are unique across all three columns. If you want to deduplicate by just one field but retain other columns, decide how to choose which associated record to keep; a simple distinct-row formula does not make that business decision for you.
Another option is Advanced Filter, which can copy unique records to another location rather than deleting entries from the source. On Windows, select the list and choose Data > Advanced in the Sort & Filter group, then choose Copy to another location and check Unique records only. The exact dialog choices depend on the selected range. This approach is useful for a one-time output, while a formula or Power Query is often more convenient when the source will be updated and the result needs refreshing.
Prevent accidental data loss next time
Before using Remove Duplicates on important data, preserve a way back. A quick copy of the worksheet or workbook is simple; for a large or regularly updated process, retaining the raw source and creating a separate cleaned output is more reliable. A backup is especially useful when the duplicate rule is not obvious or when records contain information that cannot easily be downloaded again.
- Confirm what makes a record a duplicate. An email address, account number, or a complete row can produce very different results.
- Check the selected columns and the header setting before clicking OK.
- Sort or otherwise arrange records first if you need a particular version to survive. Excel keeps the first matching record it encounters.
- Use a table or select the full set of related columns so that fields stay attached to the right record.
- For repeatable cleaning, retain the original data and use Power Query or a formula to create a separate result.
- After deduplication, check Excel’s count message and compare the output with the expected number of records.
A common misconception is that Remove Duplicates only hides repeated rows, like a filter. It does not: it removes them from the selected data. Another misconception is that choosing one column means Excel deletes only that column’s duplicate cells. The command is intended to remove duplicate records from the selected range, so the whole related table should be included to avoid separating data that belongs together.
Frequently Asked Questions
Can I undo Remove Duplicates after saving?
Often, yes, if the workbook is still open and the action remains in the undo history. Saving does not always clear that history. Try Ctrl+Z on Windows or Command+Z on Mac promptly. If you have closed and reopened the workbook, look for version history or a backup instead.
Does Remove Duplicates keep the first or last copy?
It keeps the first matching record in the current order and removes later matches. If you need a particular record to remain, sort the data into the desired order before removing duplicates, or use a separate query or output that lets you review the result.
Can I recover deleted rows if I closed Excel?
There is no guaranteed recovery command after the editing session has ended. Check OneDrive or SharePoint version history, local or organizational backups, and any original exports or copies. AutoRecover may help with some unexpected closures, but it is not a dependable record of every edit.
Does Remove Duplicates delete data from the original source?
It changes the selected worksheet data. If that data was imported from a separate source file or database, the command ordinarily changes the Excel range, not the external source itself. Power Query is a useful alternative when you want a cleaned output while keeping the imported source available.
How do I remove duplicates without losing the original list?
Copy the data before using Remove Duplicates, or create a separate result with Power Query, Advanced Filter, or the UNIQUE function in a supported Excel version. Keeping the original list intact makes it easier to revise the duplicate criteria or restore records later.
Related
- 2-Dimensional Data Table in Excel: 10 Practical Uses
- Why Is Excel Not Letting Me Transpose Data?
- Row Example in Excel: How Rows Work and How to Use Them
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Clear Cache in Microsoft Outlook: Windows, Mac & MobileTo clear cache in the Microsoft Outlook app, use the method for your device: repair or reset new…
- Multiple SUMIFS in Google Sheets: Criteria and ExamplesYes. In Google Sheets, use one SUMIFS for conditions that must all be true, and add separate SUMIFS…
- How to Hide Page Break Lines in Excel on a WorksheetTo hide page break lines in Excel for Microsoft 365 on Windows, switch to View > Normal, then…
- How to Add a Running Header in Word 2016To add a running header in Word 2016, choose Insert > Header, select a layout, and type the…
- Python Pandas Excel to CSV: Steps, Options, and FixesTo convert an Excel workbook to CSV with pandas, read a worksheet into a DataFrame with pd.read_excel(), then…
- Excel Text Upside Down: What Works and What Doesn’tIn Excel for Microsoft 365 on Windows, you cannot rotate text inside a worksheet cell a full 180…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.