Pages

Monday, December 1, 2025

Excel: Count of Duplicate

We have recently encountered duplicate data entries being created in Salesforce by automation, resulting in multiple entries with the same lookup value. 

A spreadsheet is still one of the most widely use tools shared among business users. In this blog, I'll have 2 scenarios:

1. Mark how many duplicate roles based on a key field.

I know this can be achieved easily with a pivot table, but it would be great to see the number in the table itself.

sample: Excel formula for row 2, and the unique key is in column E

=COUNTIF(E:E,E2)


2. Mark rows to be kept and to be deleted

From the duplicate row, we need to keep 1 row and delete the rest.

Excel formula for row 2 =IF(COUNTIF($E$2:E2,E2)=1, "Keep", "Delete")

Excel formula for row 3 =IF(COUNTIF($E$2:E3,E3)=1, "Keep", "Delete")