Use VLOOKUP with the First Six Digits of a Reference Number in Excel
Question details
Use the first six digits of a reference number as the key for a VLOOKUP formula.

- 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.
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.
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.
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.
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.
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.
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 a Wildcard to Match References Beginning with Six Digits
Use a wildcard when the first lookup column contains text references that begin with the parent number, such as 610002-001.
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. Open your workbook: Open WPS Spreadsheets and use Open to select your workbook.
- 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. 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. Check and save: Press Enter to check the returned value, then select Save to keep your changes.

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.




