Function Problems

How to Use VLOOKUP with Numeric Ranges and Text Suffixes

Kushani NimanthikaKushani Nimanthika Oct 26, 2026 869 views

Question details

The user needs to match complex alphanumeric codes against defined numeric ranges and specific text suffixes, and ignore any values outside the defined ranges without returning an error.

How to Use VLOOKUP with Numeric Ranges and Text Suffixes
Product
Spreadsheet
Device & OS
not provided
Scenario
Looking up values based on alphanumeric codes where the exact string is not listed in the lookup table, requiring a split between range-based numerical thresholds and text categories.
Observed behavior
Attempting to use the complete code as a literal text lookup fails because the full string is not explicitly listed, returning errors for valid items or failing to match ranges.
Before you start

Ensure your lookup table containing the numeric ranges is sorted in ascending order by the lower boundary, as this is strictly required for approximate match lookups to function correctly.

Solution 1Recommended

Separate Logic for Numbers and Suffixes

Split the alphanumeric code into its numeric and text components, perform separate lookups, and combine the results while managing errors.

Since wildcards cannot handle numerical ranges and exact text matches simultaneously, the most reliable approach is to separate the data. By extracting the number, you can leverage an approximate match VLOOKUP to find the correct range bracket. A secondary exact match VLOOKUP handles the text suffix.

Wrapping this combined logic in an error-handling function ensures that any out-of-bounds inputs fail gracefully without displaying #N/A.

1
Extract the numeric portion

Use text functions to pull the number from the string. For example, if your code is '168AR' in cell A2, use `=VALUE(LEFT(A2, 3))` to extract '168' as a pure number.

2
Extract the text suffix

Use the RIGHT function to separate the category code. In an adjacent cell, enter `=RIGHT(A2, 2)` to extract 'AR'.

3
Perform an approximate range lookup

Write a VLOOKUP formula for the extracted number using the TRUE parameter. This matches the number against the lower threshold of your range table: `=VLOOKUP(B2, NumericTableRange, 2, TRUE)`.

4
Perform an exact suffix lookup

Write a second VLOOKUP formula for the extracted suffix using the FALSE parameter to require an exact match: `=VLOOKUP(C2, SuffixTableRange, 2, FALSE)`.

5
Combine and wrap with error handling

Combine both lookups using an ampersand (&) with a hyphen between them, and wrap the entire statement in IFERROR to skip invalid codes: `=IFERROR(VLOOKUP(B2, NumericTableRange, 2, TRUE) & "-" & VLOOKUP(C2, SuffixTableRange, 2, FALSE), "")`.

Separate Logic for Numbers and Suffixes
Automating with VBA: If you are processing this in VBA rather than formulas, you can achieve the same logic by using 'Left()' and 'Right()' string functions, followed by 'Application.WorksheetFunction.VLookup()' wrapped within an 'On Error Resume Next' or 'On Error GoTo' block.
WPS Spreadsheet Solutions

Process Complex VLOOKUP Scenarios Easily in WPS Spreadsheet

WPS Spreadsheet fully supports advanced text manipulation functions, approximate VLOOKUPs, and robust error handling. You can seamlessly perform complex alphanumeric matching and format conversions without needing complicated VBA scripts.

  1. 1. Open your dataset: Launch WPS Spreadsheet and open the workbook containing your unformatted alphanumeric codes.
  2. 2. Prepare helper columns: Insert two new columns next to your raw data to hold the extracted numbers and text suffixes.
  3. 3. Apply extraction formulas: Type `=VALUE(LEFT(A2, 3))` in the number column and `=RIGHT(A2, 2)` in the suffix column, then press Enter.
  4. 4. Enter the combined formula: In your result column, type the combined lookup formula: `=IFERROR(VLOOKUP(B2, NumberTable, 2, TRUE) & "-" & VLOOKUP(C2, SuffixTable, 2, FALSE), "")`.
  5. 5. Fill the data series: Click and drag the small square fill handle at the bottom-right of your formula cell down to apply this logic to all the codes in your sheet.
Fully compatible with Microsoft Excel formulas and VLOOKUP functionsBuilt-in error handling formulas like IFERROR and IFNASupports complex nested functions for advanced data analysisFree, lightweight, and features a familiar tabbed interface
microsoft office alternative - wps office

Frequently Asked Questions

Why does my approximate VLOOKUP return incorrect values?

For an approximate VLOOKUP (using TRUE as the last argument) to function properly, the first column of your lookup table must be sorted in ascending order. If it is unsorted, the formula will return incorrect matches or #N/A errors.

Can I use wildcard characters to match ranges in VLOOKUP?

No, wildcards like asterisks (*) or question marks (?) only work for exact text matches. To match a number within a range bracket, you must extract the numeric value and use an approximate match against the lower boundaries of your ranges.

How do I ignore codes that don't match any range or suffix?

You can wrap your main VLOOKUP formula inside the IFERROR function. For example, using =IFERROR([Your VLOOKUP Formula], "") will return a completely blank cell instead of displaying an error code if the lookup value falls outside your defined parameters.

How do I extract the numeric portion if the lengths vary?

If your alphanumeric codes have variable lengths (e.g., '16AR' and '1684AR'), relying on a fixed LEFT(A2, 3) will fail. You can instead isolate the text suffix using the RIGHT function, and use the SUBSTITUTE function or advanced LEN calculations to remove the suffix string, leaving only the variable-length number.