Extracting a State and a ZIP Code in Excel

Excel is a powerful tool that can help you manage and analyze data in a variety of ways. One common task is extracting specific information from a larger data set. In this article, we will explore how to extract a state and a ZIP code from a list of addresses in Excel.

Step 1: Separate the Address into Columns

The first step in extracting a state and a ZIP code from an address is to separate the address into columns. In most cases, an address will include the street address, city, state, and ZIP code. To separate these elements into columns, you can use the Text to Columns feature in Excel.

To use Text to Columns, follow these steps:

  1. Select the column that contains the addresses you want to separate.
  2. Click on the Data tab in the ribbon.
  3. Click on the Text to Columns button.
  4. Choose the Delimited option and click Next.
  5. Select the delimiter that separates the address elements (usually a comma or a space) and click Next.
  6. Choose the format for each column (General, Text, Date, etc.) and click Finish.

After you have separated the address into columns, you should have a column for the street address, a column for the city, a column for the state, and a column for the ZIP code.

Step 2: Extract the State

Now that you have a column for the state, you can extract the state abbreviation using a formula. The state abbreviation is always two letters, so you can use the LEFT function to extract the first two letters from the state column.

To extract the state abbreviation, follow these steps:

  1. Create a new column next to the state column.
  2. Enter the formula =LEFT(cell,2) in the first cell of the new column, where “cell” is the cell containing the state abbreviation.
  3. Copy the formula down to the rest of the cells in the column.

After you have extracted the state abbreviation, you can use Excel’s filtering or sorting features to analyze the data by state.

Step 3: Extract the ZIP Code

Extracting the ZIP code is a bit more complicated than extracting the state abbreviation, but it can still be done using a formula. The ZIP code is always five digits, but it may be preceded by a hyphen and four additional digits. To extract the ZIP code, you will need to use a combination of the LEFT and RIGHT functions.

To extract the ZIP code, follow these steps:

  1. Create a new column next to the address column.
  2. Enter the formula =RIGHT(cell,5) in the first cell of the new column, where “cell” is the cell containing the address.
  3. If the ZIP code is preceded by a hyphen and four additional digits, enter the formula =LEFT(cell,5) in the first cell of another new column.
  4. Use the IF function to combine the two formulas into one. The formula should look like this: =IF(RIGHT(cell,5)=”XXXXX”,RIGHT(cell,5),LEFT(cell,5)), where “XXXXX” is the hyphen and four additional digits.
  5. Copy the formula down to the rest of the cells in the column.

After you have extracted the ZIP code, you can use Excel’s filtering or sorting features to analyze the data by ZIP code.

Conclusion

Extracting a state and a ZIP code from a list of addresses in Excel can be a bit tricky, but it is definitely doable. By separating the address into columns and using formulas to extract the state abbreviation and the ZIP code, you can quickly and easily analyze your data by state or ZIP code.

Related

Did you find this article useful?

Share it with your friends or colleagues

About Aepoch Advisors

We are a boutique accounting and consulting firm servicing international businesses operating in China. We offers book keeping and business advisory service. We also help our clients select and implement SAAS business applications
 
Cloud technology significantly reduces cost foreign companies traditionally spent on tax compliance and ERP systems. Our cloud professionals can help with streamlining your management and controling structure, as well as advising you on how to reduce risks and maximize profits with software purposely built for Chinese business. Contact us today to learn more about our services.