Function Problems

Use VLOOKUP with the First Six Digits of a Reference Number in Excel

John WilsonJohn Wilson Nov 27, 2026 869 views

Question details

Use the first six digits of a reference number as the key for a VLOOKUP formula.

Use VLOOKUP with the First Six Digits of a Reference Number in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A reference such as 610002-001 contains a six-digit parent number followed by a child identifier.
Observed behavior
The lookup should match the six-digit parent number or a reference beginning with those six digits.
Before you start

Check whether the first column of your lookup range contains six-digit parent numbers or full references. Also check whether the lookup values are stored as text or numbers, because the formula must use a matching data type.

Solution 1Recommended

Use LEFT and VLOOKUP to Match a Six-Digit Parent Number

Use this method when the first column of the lookup range contains six-digit parent numbers.

1
Identify the lookup range

Locate the table containing the parent numbers and return values, such as D1:E5. The parent numbers must be in the first column of that range.

2
Enter the text-key formula

In an empty cell, enter =VLOOKUP(LEFT(B3,6),D1:E5,2,FALSE) if the parent numbers in column D are stored as text. Replace B3 and D1:E5 with your reference cell and lookup range.

3
Convert the key if needed

If the parent numbers in column D are stored as numbers, enter =VLOOKUP(--LEFT(B3,6),D1:E5,2,FALSE) instead. The double minus converts the extracted text to a number.

4
Check the result

Press Enter. The formula returns a value from the second column of the range; change 2 to another column number if your return value is elsewhere in the range.

Use LEFT and VLOOKUP to Match a Six-Digit Parent Number
Preserve leading zeros: If parent numbers contain leading zeros, store them as text and use the text-key formula. Converting the key to a number removes leading zeros.
WPS Spreadsheets

Look Up Reference Numbers in WPS Spreadsheets

Use LEFT and VLOOKUP in WPS Spreadsheets to find a parent number from the first six digits of a reference.

  1. 1. Open your workbook: Open WPS Spreadsheets and use Open to select your workbook.
  2. 2. Locate the reference and lookup table: Find the reference cell, such as B3, and the lookup range, such as D1:E5. Put the parent numbers in the first column of the range.
  3. 3. Enter the formula: Select an empty cell and enter =VLOOKUP(LEFT(B3,6),D1:E5,2,FALSE) for text parent numbers. For numeric parent numbers, use =VLOOKUP(--LEFT(B3,6),D1:E5,2,FALSE).
  4. 4. Check and save: Press Enter to check the returned value, then select Save to keep your changes.
Extract and look up six-digit parent numbers with familiar formulas.Open and edit Microsoft Excel XLS and XLSX files.Use wildcard lookups to find text references with a shared prefix.Work in a familiar spreadsheet interface with a free Office suite.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my VLOOKUP return #N/A when the parent number is present?

The extracted key and the first lookup column may have different data types. Use LEFT(B3,6) for text keys or --LEFT(B3,6) for numeric keys, and confirm that the key is in the first column of the lookup range.

How can I look up a full reference that starts with 610002?

If the references are stored as text in the first column of D1:E5, enter =VLOOKUP(610002&"*",D1:E5,2,FALSE). The asterisk matches any following characters.

What happens if several references have the same first six digits?

A wildcard VLOOKUP returns the value from the first matching row in the lookup range. Use a more specific key if you need a particular child reference.

Can I use these formulas in WPS Spreadsheets?

Yes. Open your workbook in WPS Spreadsheets, select an empty cell, and enter the same LEFT and VLOOKUP formula using your worksheet's cell references.