How to remove duplicates keep last
Tutor 5 (87 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Removing duplicates while keeping the last occurrence means Excel deletes all repeated entries except the final one that appears at the bottom of the dataset. Excel does not include a built-in “keep last” button, so the process uses sorting and the Remove Duplicates feature.
How to remove duplicates and keep the last occurrence in Excel
To remove duplicates and keep the final appearance of each unique value, follow the steps below.
Windows and Mac (same steps)
Select the entire dataset you want to clean.
Apply a sort that puts the last occurrence of each duplicate at the bottom.
Sort by the column that contains duplicates.
Sort Z → A (descending order).
Confirm that the most recent or bottom-most records appear at the top after sorting.
Keep the sorted range selected.
Go to Data → Remove Duplicates.
Select the column that contains duplicates.
Click OK. Excel removes every earlier copy and keeps the last occurrence you sorted to the top.
Sort the data back to the original order if needed using your date/ID/index column.
Why sorting matters when keeping the last occurrence
Sorting reverses the order of the column that contains duplicates. The last occurrence becomes the first visible one in the sorted list. Remove Duplicates keeps the first instance it encounters, so the process preserves what originally appeared last.
How to keep the last duplicate when your dataset contains multiple columns
Sort the dataset so the last occurrence moves to the top.
Select every column in the table.
Remove duplicates based on the column that defines “duplicate.”
Confirm the table contains one record per unique value with the last version preserved.
Can Power Query keep the last duplicate?
Yes. Power Query automates this task.
Steps
Select your dataset.
Go to Data → From Table/Range.
In Power Query, sort the duplicate column descending.
Select the duplicate column.
Choose Home → Remove Rows → Remove Duplicates.
Load the data back into Excel.
Power Query removes duplicates while keeping the last occurrence because the sort controls which entry appears first in the query engine.
Does Excel VBA keep the last duplicate?
Yes. VBA can perform the same task through automated sorting and removal, although manual methods are more transparent.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to show duplicates in red
Answers · 1
How to apply duplicate conditional formatting rule
Answers · 1
How to duplicate conditional formatting excel
Answers · 1
What is excel conditional formatting duplicates
Answers · 1