Spreadsheet skills

How do you check for duplicate spreadsheet lookup keys?

Short answer

Count occurrences of the selected key with COUNTIF before using an exact lookup. A count of zero means missing, one means unique, and more than one means duplicated. If multiple records per key are legitimate, choose a more specific key or an aggregation rule. Returning the first matching record does not resolve an ambiguous source table.

For keys in A11:A70 and a selected key in B8, use =COUNTIF(A11:A70,B8). Add an explanatory result around the lookup, such as Duplicate SKU, when the count exceeds one.

When should duplicate lookup keys be retained?

An order table can contain several rows per customer because each row is a different order. In that case, sum the amounts by customer instead of treating the customer column as a unique price-table key. Keep the row’s meaning explicit before removing duplicates.