Function Problems

Extract Postal Code Prefixes in Excel When the Second Character Is a Number

Olivia MillerOlivia Miller Dec 2, 2026 869 views

Question details

Extract the letter prefix from a postal code when its second character may be a number.

Extract Postal Code Prefixes in Excel When the Second Character Is a Number
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains postal codes such as W8, W1, N1, or SW1, and the user needs the one- or two-letter prefix.
Observed behavior
The desired result is W for W8 and SW for SW1.
Before you start

Check that each postal code starts with a letter and that its second character is either a letter or a digit. Remove leading spaces or other unexpected formatting before applying the formula.

Solution 1Recommended

Use a formula to extract the postal code prefix

Return the first character if the second is numeric; otherwise, return the first two characters.

1
Enter the formula

With the postal code in cell A1, select an empty cell such as B1 and enter =LEFT(A1,2-ISNUMBER(--RIGHT(LEFT(A1,2)))).

2
Check the result

Press Enter. A postal code beginning with W8 returns W, while one beginning with SW returns SW.

3
Apply it to other rows

Select B1 and drag its fill handle down alongside the remaining postal codes.

Use a formula to extract the postal code prefix
Formula scope: This formula assumes a one- or two-letter prefix and does not validate the full postal code. It does not remove leading spaces or other unexpected formatting.
WPS Office solution

Extract postal code prefixes in WPS Spreadsheet

Use the same LEFT and ISNUMBER formula in WPS Spreadsheet to extract one- or two-letter prefixes from postal codes.

  1. 1. Open the spreadsheet: Open WPS Spreadsheet and use Open to select your workbook.
  2. 2. Enter the formula: With a postal code in A1, select B1 and enter =LEFT(A1,2-ISNUMBER(--RIGHT(LEFT(A1,2)))).
  3. 3. Fill the column: Press Enter, then drag the fill handle from B1 down to the other rows.
  4. 4. Save the workbook: Choose File > Save or Save As and select an Excel-compatible format if needed.
Extract prefixes from codes such as W8 and SW1Open and edit Microsoft Excel XLSX and XLS filesFill formulas down a column in a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

What does the formula return for W1 and N1?

When the postal code is in A1, =LEFT(A1,2-ISNUMBER(--RIGHT(LEFT(A1,2)))) returns W for W1 and N for N1.

Will the formula return both letters for SW1?

Yes. Because the second character is a letter, the formula returns the first two characters: SW.

How do I apply the formula to a whole column?

Enter the formula in B1 next to the first postal code in A1, then drag B1's fill handle down. The cell references adjust for each row.

Does this formula validate postal codes?

No. It extracts a prefix based on whether the second character is numeric. Check the source data separately for leading spaces, unusual formatting, and invalid postal codes.