Skip to main content
Question

removing records that have duplicate values in 1 field


Forum|alt.badge.img+2

This question is similar to what another person asked here:


I would like to also:

1- Select the fields where duplicates values exist.
2- Select to keep the newest record to keep
3- Run it and be done.

however I would like this to be the case with newly created records as well. Every new record that contains a duplicate value in a field would be kept while the existing record with the same value would be deleted. This way the newest record with the value is kept, the old is deleted. The solution in the above link only works for existing records, not newly created records. So I was wondering if there is a way to delete records in this way in Airtable.

 

fyi: my new records are being made using a post API request, if that information helps.

 

thank you

5 replies

furqanhamid
Forum|alt.badge.img+1
  • New Participant
  • 2 replies
  • March 15, 2025

That makes sense! You could set up an automation in Airtable that triggers on new record creation, checks for duplicates in the selected field, and deletes the older entry. A script in Airtable Automations or a third-party tool like Make/Zapier might help streamline this.


ScottWorld
Forum|alt.badge.img+33
  • Brainy
  • 8858 replies
  • March 15, 2025

@manguy43 

I have several clients automatically deleting duplicates by using Make’s advanced Airtable automations.

As @furqanhamid mentioned above, automating the deletion of records can only be done via JavaScript or via 3rd-party automation tools that tap into Airtable's API, such as Make (which is far superior to Zapier).

If you’ve never used Make before, I’ve assembled a bunch of Make training resources in this thread. For example, here is one of the ways that you could instantly trigger a Make automation from Airtable.

Hope this helps! If you’d like to hire the best Airtable consultant to help you with anything Airtable-related, please feel free to contact me through my website: Airtable consultant — ScottWorld


Forum|alt.badge.img+2
  • Author
  • New Participant
  • 4 replies
  • March 15, 2025

Hi ​@ScottWorld and ​@furqanhamid,

thank you guys for the prompt response. I have taken into account your feedback and tried to use make to form an automation. However, as a first-time make user, it’s been hard figuring out what the issue is with my automation.
 

connected to airtable via oauth, made watch records as trigger and search/delete records as action. I have also Run the automation without any formula, all records are deleted in my airtable.
I think it may be an issue with the formula, when I run it it says “
Deviceid is the unique field, and I have another field called created time which is the time the record was created


I’m sorry, I think the issue lies within the formula field but I have no idea what to do to fix it. Please help


ScottWorld
Forum|alt.badge.img+33
  • Brainy
  • 8858 replies
  • March 15, 2025

Where you typed in “map device ID automatically”, simply replace that text by mapping the device ID from your first module (the watch records module).

Also, be sure to put that in double quotation marks instead of single quotation marks.

Additionally, I’m not sure if Airtable will understand {Created Time} < TODAY(). You’d have to try that in a formula field in Airtable to see if that gives you proper results. 


TheTimeSavingCo
Forum|alt.badge.img+28

Ah I’ve done this before with just Airtable automations before and I’ve set it up here for you to check out!  Here’s an example of it working:

 

The idea is that we use a ‘Find record’ automation to look for records with the same duplicate value, but also exclude the newly created record from that search:

 

And if we manage to find records with the same value as the newly created record, then we run a script action to delete them all, and here’s how the script woud look:

You’d need to update the script and replace the table ID though, e.g.:


let {recordIds} = input.config()

while (recordIds.length > 0) {
await base.getTable('YOUR_TABLE_ID').deleteRecordsAsync(recordIds.slice(0, 50));
recordIds = recordIds.slice(50);
}

Let me know if you have any problems setting it up and I’ll see what I can do to help!
 

Reply