I have a persons table with duplicate person inserted with different id. I want to delete the person with duplicate names keeping only the person with the minimum ID. for e.G The record for Absalon with ID 18398 should remain and all the other duplicates are deleted.
1. If you want to remove all duplicates but leave the highest ones, you can apply this formula =MAX(IF($A$2:$A$12=D2,$B$2:$B$12)), remember to press Shift + Ctrl + Enter keys. 2. In the above formulas, A2:A12 is the original list you need to remove duplicates from.
When you use the Remove Duplicates feature, the duplicate data will be permanently deleted. Before you delete the duplicates, it's a good idea to copy the original data to another worksheet so you don't accidentally lose any information. Select the range of cells that has duplicate values you want to remove.
If you sort on col A and then descending by col C, you can then just select all columns and do Data > Remove duplicates.
DELETE FROM persons WHERE id NOT IN (SELECT MIN(id) FROM persons GROUP BY name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With