New Tool Radar

AI for Data & Spreadsheets

How to Check an AI-Built Lookup Key for Separator Collisions

Check an AI-built lookup key for two different records that produce the same joined text.

Schematic with three steps: Count unique keys against unique records; Find the colliding records; Rebuild the key with a separator that.

Joining two fields into one lookup key, such as a first name and a surname, works until two different records join into the same text: “Ann” plus “Lee” and “Ann Lee” plus nothing can both become “AnnLee”. An AI assistant that builds keys with a plain join creates these collisions silently, and the lookup then returns the wrong record. Check the key for collisions before using it.

What you need

  • The AI-built lookup key formula
  • The two fields it joins, with their values visible
  • A count of unique keys versus unique records

Step 1: Count unique keys against unique records

Count the distinct values of the key column and count the records. If the key count is smaller than the record count, at least two records share a key.

Step 2: Find the colliding records

Sort by the key column and look for the same key on two different rows. Read the joined fields on those rows and work out how the same text came from different values.

Step 3: Rebuild the key with a separator that cannot collide

Join the fields with a separator that never appears inside the values, such as ” | “, and re-count the unique keys. The key count must now equal the record count.

Worked example: synthetic customer list

The table below is a synthetic example. It shows the expected result of checking a joined lookup key; no formula was run.

Check Value Result
Records in the list 8 Source
Unique keys, plain join 7 One collision
Colliding keys AnnLee Two different people
Unique keys, separator join 8 No collision
Separator used ” | “ Not found in values

Expected result (UNTESTED). a plain join gives 7 unique keys for 8 records because two different people both produce AnnLee; joining with ” | ” gives 8 unique keys and no collision. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A separator that appears inside a value can collide too; pick one that never occurs in the data.
  • TRIM the fields before joining, or trailing spaces create keys that look the same but are not.
  • A key built from a name is not stable when names change; an ID is a safer key.
  • Case differences do not separate keys in a lookup; AnnLee and annlee match as the same key.

Sources

See all