---
name: check-a-lookup-table
description: "Check a VLOOKUP, XLOOKUP or similar lookup for silent wrong matches: approximate mode on an exact ID, unsorted bands, duplicate keys and text-versus-number IDs. Use when a spreadsheet lookup returns a price, rate, code or category that someone needs to trust."
license: CC-BY-4.0
metadata:
  author: Raq.com
  version: "2026-11-22"
  homepage: https://skills.raq.com/skills/check-a-lookup-table
---

# Check a lookup table for silent wrong matches

Review lookup mode, ordering and duplicate keys before using a spreadsheet result for prices, rates or classifications.

## When to use this skill

- A VLOOKUP or XLOOKUP returns a price, rate, code or category and someone wants to be sure it is the right row.
- A lookup result looks plausible but the table may have duplicate keys or be unsorted.
- IDs with leading zeros, such as 0042, may be stored as text in one place and as numbers in another.

## When not to use it

- Predicting how many rows a database or pandas join will return. Use the join row-count skill.
- Auditing a whole block of formulas for shifted references and wrong totals. Use the spreadsheet formula audit skill.

## What you need

- Lookup formula, lookup value, lookup table in source order, and whether the question asks for an exact ID or a band.
- The intended treatment of duplicate keys and the result column.

## Ask before you start

If any of these are missing or unclear, ask before doing the work.

- Is the lookup meant to find an exact ID, such as a SKU or account code, or a band, such as a quantity break or tax band?
- Can you share the formula and the lookup table in its current order, including how the key column is stored?
- If a key appears more than once, which row should win, and who decides?

## Method

1. Read the match mode. In VLOOKUP, FALSE or 0 asks for an exact match; TRUE, 1 or an omitted last argument selects approximate matching. XLOOKUP matches exactly by default, and only its binary search modes assume sorted data.
2. For an exact-ID request, flag approximate mode even if the current result looks plausible. Whenever approximate mode is used, check that the first column is in ascending order.
3. For exact lookups, find every row matching the key under the spreadsheet's matching rules: text matching ignores case, and the text 0042 does not match the number 42. Surface the distinct return values before any selection, including tied or reused keys. Never coerce IDs to numbers.
4. Count duplicates with a type-strict comparison such as SUMPRODUCT(--(A2:A100=key)) rather than COUNTIF. COUNTIF can read the criterion "0042" as the number 42 and count a stored 42 as well as the text, so it overcounts numeric-looking IDs.
5. For a genuinely banded schedule with verified ascending lower bounds, choose the value at the greatest bound that does not exceed the request. A value below the lowest bound has no match.
6. Report the candidate rows, the value the formula returns now and the fix: exact mode, a sorted band table, a unique key or a key column stored consistently as text.

## Checks before you deliver

- Reordering an approximate table can change results. A correct output for one lookup does not validate the table.
- Exact lookup ordinarily returns the first match. It does not resolve competing rows or make an identifier case-sensitive.
- Wrapping a lookup in IFERROR(..., 0) turns a missing key into a zero price or rate without any warning.
- A key stored as the number 42 on one side and the text 0042 on the other does not match, so the lookup fails or finds a different row.
- Checking for duplicates with COUNTIF can overcount when IDs look like numbers.

## How to present the result

Lead with whether the result can be trusted, in one sentence. Then list each issue with the rows involved, the candidate values in table order and the value the formula returns now. End with the corrected formula or table change, and the decision the table owner must make where duplicate keys disagree.

## Worked example

**Request:** Check this exact SKU request for B. Return price as display text.

**Supplied material:**

```text
=VLOOKUP("B",A2:B4,2)
SKU|price
B|£6
A|£4
B|£7
```

**Answer:** Hold the price for SKU B. The two B rows show £6 and £7, and the omitted lookup argument selects approximate matching on an unsorted table. Confirm which price applies, resolve the duplicate and use FALSE for exact SKU matching.

## Structured output for tests

For an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.

Return issues as applicable codes in this order: wrong-mode, unsorted-bands, duplicate-key, no-match. Return candidates as distinct return-column strings in source order for exact requests; for a valid band request return its single applicable return value. For invalid band inputs return an empty candidates list.

## Sources

- [Microsoft Excel: VLOOKUP function](https://support.microsoft.com/en-us/excel/functions/vlookup-function): Approximate match is the default when the last argument is omitted and needs the first column sorted; FALSE searches for the exact value. In approximate mode a value below the smallest in the first column returns #N/A, and numbers or dates stored as text can give unexpected results.
- [Microsoft Excel: XLOOKUP function](https://support.microsoft.com/en-us/office/xlookup-function-b7fd680e-6d10-43e6-84f9-88eae8bf5929): XLOOKUP produces an exact match by default, searches from the first item unless search_mode says otherwise, and relies on sorted data only in its binary search modes. This is why the first match wins and why only some modes need sorting.

Test cases and an answer checker for this skill: https://skills.raq.com/skills/check-a-lookup-table
