How to Remove the Last 4 Digits of a Zip Code in Excel – 10 Methods

This is the sample dataset.

Remove Last 4 Digit of Zip Code in Excel


Method 1 – Applying the LEFT Function to Remove the Last 4 Digits of a Zip Code

Steps:

  • Click D5.
  • Enter the following formula.

C5 refers to the cell with the 9-digit Zip code. “5” refers to the number of digits you want to keep from the left).

=LEFT(C5,5)

The LEFT function returns the first character or characters in a text string, based on the number of characters you specify. Here, it returns the first 5 digits in C5.

Remove last 4 digit of Zip codes using LEFT Function

  • Press Enter.

The last 4 digits of the Zip code are removed.

  • Drag down the Fill Handle to see the result in the rest of the cells.

Remove Last 4 digit in Excel using LEFT Function

This is the output.

Remove last 4 digit of Zip Codes using LEFT FUnction

Read More: How to Format Zip Code to 5 Digits in Excel


Method 2 – Use the MID Function to Cut the Last 4 Digits of the Zip Code

Steps:

  • Click D5.
  • Enter the following formula.
=MID(C5, 1, 5)

C5 refers to the cell containing the Zip code. To keep the first 5 digits, “1” and “5” are used. The MID function returns the digits from the first to the fifth digit.

How to remove last 4 digit of Zip codes using MID Function.

  • Press Enter.

D5 will show the first 5 digits of the Zip code.

How to remove last 4 digit of Zip codes using MID Function

  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.

Read More: [Fixed] Zip Codes in Excel Starting with 0


Method 3 – Use the Text to Columns Feature

Steps:

  • Select the column containing the Zip codes.

How to remove last 4 digit of Zip codes using Text to Column tool

  • Go to Data.

How to remove last 4 digit of Zip codes using Text to Column tool

  • Click Text to Columns.
  • Select Delimited and click Next.

How to remove last 4 digit of Zip codes using Text to Column tool

  • Enter “” in Other to separate the digits.
  • Click Next.

How to remove last 4 digit of Zip codes using Text to Column tool

  • Enter the Destination or click the small arrow and select the cell.
  • Click Finish.

This is the output.

How to remove last 4 digit of Zip codes using Text to Column tool

Read More: How to Sort Data by Zip Code in Excel


Method 4 – Applying the INT Function to Remove the Last 4 Digits of the Zip Code in Excel

Steps:

  • Click D5.
  • Enter the following formula.
=INT(C5/10000)

C5 is divided by 10000 to remove the last 4 digits. The INT Function returns the integer value.

How to remove last 4 digit of Zip codes using INT Function

  • Press Enter.

  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.

How to remove last 4 digit of Zip codes using INT Function

Read More: How to Concatenate ZIP Codes in Excel


Method 5 – Combine the INT and the SUBSTITUTE Functions

Steps:

  • Replace “” with”.”.
  • Click D5.
  • Enter the following formula.
=SUBSTITUTE(C5, “-”, ”.”)

The following formula will return an integer value:  the 5 digit Zip code.

=INT(D5)
  • You can get the result directly by combining these formulas:
=INT(SUBSTITUTE(C5, “-”, ”.”)

How to remove last 4 digit of Zip codes using INT and SUBSTITUTE Function

  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.


Method 6 – Merging the TEXT and the LEFT Functions

Steps:

  • Click D5.
  • Enter the following formula.
=LEFT(TEXT(C5,"00000"),5)

How to remove last 4 digit of Zip codes using TEXT and LEFT Functions

  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.


Method 7 – Running a VBA Code to Remove the Last 4 Digits of the Zip Code in Excel

Steps:

  • Select the column containing the Zip codes.

How to remove last 4 digit of Zip codes using a VBA Code

  • Right-click the Sheet (it was named VBA Code).
  • Select View Code.

How to remove last 4 digit of Zip codes using a VBA Code

  • Copy the following code into the window.
Sub ZIPShorter () 
For Each cell In Selection cell.Value = Left(cell.Value, 5)
Next 
End Sub
How to remove last 4 digit of Zip codes using a VBA Code
  • To run the code, press alt+F8 and click Run.

How to remove last 4 digit of Zip codes using a VBA Code

This is the output.


Method 8 – Combine the SUM, LEN, and SUBSTITUTE Functions

Steps:

  • Click D5.
  • Enter the following formula.
=IF(SUM(LEN(C5)-LEN(SUBSTITUTE(C5,{1,2,3,4,5,6,7,8,9,0},)))>5,LEFT(C5,LEN(C5)-5),C5)

How to remove last 4 digit of Zip codes using SUM, LEN, SUBSTITUTE Function

Formula Breakdown

  • SUM(LEN(C5)-LEN(SUBSTITUTE(C5,{1,2,3,4,5,6,7,8,9,0},)))>5  counts the number of digits in C5. If the total number of digits is more than 5, it will proceed to the next operation.
  • LEFT(C5,LEN(C5)-5) cuts the last 4 digits in C5
  • If the number in C5 is not more than 5 digits, the final formula returns the C5 value.
  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.


Method 9 – Merging the LEFT, MIN, and FIND Functions to Remove the Last 4 Digits of the Zip Code in Excel

Steps:

  • Click D5.
  • Enter the following formula.
=LEFT(C5,MIN(FIND({0,1,2,3,4,5,6,7,8,9},C5&"0123456789"))+4)

How to remove last 4 digit of Zip codes using LEFT, MIN & FIND Functions

Formula Breakdown

  • The FIND function provides the starting position of a string within a string. So its find_text argument is {0,1,2,3,4,5,6,7,8,9}, and it will find the string within C5.
  • The MIN function returns the smallest numbers extracted by the FIND function (FIND({0,1,2,3,4,5,6,7,8,9},C5&”0123456789″)
  • The LEFT function returns the specified number of characters from the start of the string. Here, the last 4 digits.

 

  • Press Enter.
  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.

Read More: How to Find ZIP Code from Address in Excel


Method 10 – Combining the ISNUMBER, RIGHT, LEFT, and LEN Functions

Steps:

  • Click D5.
  • Enter the following formula.
=IF(ISNUMBER(RIGHT(C5,8)*1),LEFT(C5,LEN(C5)-4),C5)

How to remove last 4 digit of Zip codes using ISNUMBER, RIGHT, LEFT & LEN Functions

Formula Breakdown

  • The RIGHT Function returns the specific number of characters from the end of the string. Its reference cell number is C5, and num_chars is 8. The formula becomes, RIGHT(C5,8)*1
  • The ISNUMBER Function verifies if the result found by RIGHT(C5,8) is a number. If so, it shows the result of this formula LEFT(C5,LEN(C5)-4) which cuts the last 4 digits from the zip code. If not, the formula returns the value in C5.
  • Press Enter.

The last 4 digits of the Zip code are removed.

  • Drag down the Fill Handle to see the result in the rest of the cells.

This is the output.

● Hit Enter. It will eliminate the last 4 digits of the code. ● Finally, Get the results for all the Zip codes by double clicking the bottom right corner of the cell D5.

Read More: How to Format Zip Codes in Excel

 


Download Practice Workbook

Download the practice workbook.


<< Go Back to Zip Code in Excel | Number Format | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Alif Bin Hussain
Alif Bin Hussain

Alif Bin Hussain earned a BSc in Civil Engineering from Bangladesh University of Engineering and Technology. As an engineering graduate, he has a deep passion for research and innovation. He loves to play with Excel. In his role as an Excel & VBA Content Developer at ExcelDemy, he not only solves tricky problems but also shows enthusiasm and expertise in handling tough situations with finesse, emphasizing his dedication to delivering top-notch content. He is interested in C, C++,... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo