Intro
Extract city names from addresses in Excel using formulas and functions, including TEXTSPLIT, FILTER, and VLOOKUP, to parse and manipulate location data efficiently.
Extracting city names from addresses in Excel can be a daunting task, especially when dealing with large datasets. However, with the right techniques and formulas, you can efficiently extract city names from addresses. In this article, we will explore the importance of extracting city names, the benefits of using Excel for this task, and provide step-by-step guides on how to do it.
Extracting city names from addresses is crucial in various industries, such as marketing, logistics, and customer service. It helps in identifying customer locations, analyzing market trends, and optimizing delivery routes. Moreover, having a separate column for city names makes it easier to filter, sort, and analyze data. With Excel, you can easily extract city names from addresses using formulas, functions, and add-ins.
The benefits of using Excel for extracting city names include increased efficiency, accuracy, and flexibility. Excel provides a range of formulas and functions that can be used to extract city names, such as the TEXT TO COLUMNS feature, the Flash Fill feature, and the VLOOKUP function. Additionally, Excel add-ins like Power Query and Power Pivot can be used to extract city names from large datasets.
Understanding Address Formats

Before extracting city names, it's essential to understand the different address formats used in various countries and regions. Address formats can vary significantly, making it challenging to extract city names. For example, in the United States, the address format is typically "Street Address, City, State, ZIP Code," while in the United Kingdom, the format is "Street Address, City, Postcode." Understanding these formats is crucial in developing effective formulas and functions to extract city names.
Using Formulas to Extract City Names

Excel provides several formulas that can be used to extract city names from addresses. One of the most common formulas is the TEXT TO COLUMNS feature, which allows you to split text into separate columns based on a delimiter. For example, if you have an address in the format "Street Address, City, State, ZIP Code," you can use the TEXT TO COLUMNS feature to split the address into separate columns for street address, city, state, and ZIP code.
Another formula that can be used to extract city names is the Flash Fill feature, which is available in Excel 2013 and later versions. The Flash Fill feature allows you to automatically fill a range of cells with a formula based on a sample value. For example, if you have a list of addresses in the format "Street Address, City, State, ZIP Code," you can use the Flash Fill feature to extract the city names and fill a separate column with the extracted values.
TEXT TO COLUMNS Feature
The TEXT TO COLUMNS feature is a powerful tool in Excel that allows you to split text into separate columns based on a delimiter. To use the TEXT TO COLUMNS feature, follow these steps:- Select the range of cells that contains the addresses
- Go to the "Data" tab in the ribbon
- Click on the "Text to Columns" button
- Select the delimiter that separates the city name from the rest of the address (e.g., comma, space, etc.)
- Click "Finish" to split the text into separate columns
Flash Fill Feature
The Flash Fill feature is a powerful tool in Excel that allows you to automatically fill a range of cells with a formula based on a sample value. To use the Flash Fill feature, follow these steps:- Select the range of cells that contains the addresses
- Go to the "Data" tab in the ribbon
- Click on the "Flash Fill" button
- Enter a sample value for the city name (e.g., "New York")
- Press "Enter" to fill the range of cells with the extracted city names
Using Functions to Extract City Names

Excel provides several functions that can be used to extract city names from addresses. One of the most common functions is the VLOOKUP function, which allows you to look up a value in a table and return a corresponding value from another column. For example, if you have a table that contains a list of cities and their corresponding ZIP codes, you can use the VLOOKUP function to extract the city name from an address based on the ZIP code.
Another function that can be used to extract city names is the INDEX/MATCH function, which allows you to look up a value in a table and return a corresponding value from another column. The INDEX/MATCH function is more flexible than the VLOOKUP function and can be used to extract city names from addresses with multiple delimiters.
VLOOKUP Function
The VLOOKUP function is a powerful tool in Excel that allows you to look up a value in a table and return a corresponding value from another column. To use the VLOOKUP function, follow these steps:- Select the range of cells that contains the addresses
- Go to the "Formulas" tab in the ribbon
- Click on the "VLOOKUP" button
- Enter the lookup value (e.g., ZIP code)
- Enter the table array (e.g., list of cities and ZIP codes)
- Enter the column index (e.g., column that contains the city names)
- Click "Enter" to extract the city name
INDEX/MATCH Function
The INDEX/MATCH function is a powerful tool in Excel that allows you to look up a value in a table and return a corresponding value from another column. To use the INDEX/MATCH function, follow these steps:- Select the range of cells that contains the addresses
- Go to the "Formulas" tab in the ribbon
- Click on the "INDEX/MATCH" button
- Enter the lookup value (e.g., ZIP code)
- Enter the table array (e.g., list of cities and ZIP codes)
- Enter the column index (e.g., column that contains the city names)
- Click "Enter" to extract the city name
Using Add-Ins to Extract City Names

Excel provides several add-ins that can be used to extract city names from addresses. One of the most common add-ins is Power Query, which allows you to import and transform data from various sources. Power Query provides a range of functions and formulas that can be used to extract city names from addresses, including the TEXT TO COLUMNS feature and the VLOOKUP function.
Another add-in that can be used to extract city names is Power Pivot, which allows you to create data models and perform data analysis. Power Pivot provides a range of functions and formulas that can be used to extract city names from addresses, including the INDEX/MATCH function and the VLOOKUP function.
Power Query
Power Query is a powerful add-in in Excel that allows you to import and transform data from various sources. To use Power Query, follow these steps:- Go to the "Data" tab in the ribbon
- Click on the "New Query" button
- Select the data source (e.g., list of addresses)
- Click on the "Transform" button
- Use the TEXT TO COLUMNS feature or the VLOOKUP function to extract the city name
Power Pivot
Power Pivot is a powerful add-in in Excel that allows you to create data models and perform data analysis. To use Power Pivot, follow these steps:- Go to the "Data" tab in the ribbon
- Click on the "Power Pivot" button
- Create a new data model
- Import the data source (e.g., list of addresses)
- Use the INDEX/MATCH function or the VLOOKUP function to extract the city name
Gallery of City Name Extraction Methods










What is the best method to extract city names from addresses in Excel?
+The best method to extract city names from addresses in Excel depends on the format of the addresses and the complexity of the data. The TEXT TO COLUMNS feature, Flash Fill feature, and VLOOKUP function are popular methods used to extract city names.
How do I use the TEXT TO COLUMNS feature to extract city names?
+To use the TEXT TO COLUMNS feature, select the range of cells that contains the addresses, go to the "Data" tab in the ribbon, click on the "Text to Columns" button, select the delimiter that separates the city name from the rest of the address, and click "Finish" to split the text into separate columns.
Can I use the VLOOKUP function to extract city names from addresses with multiple delimiters?
+No, the VLOOKUP function is not suitable for extracting city names from addresses with multiple delimiters. The INDEX/MATCH function or the Flash Fill feature may be more effective in such cases.
What are the benefits of using Power Query to extract city names from addresses?
+Power Query provides a range of functions and formulas that can be used to extract city names from addresses, including the TEXT TO COLUMNS feature and the VLOOKUP function. It also allows you to import and transform data from various sources, making it a powerful tool for data analysis.
Can I use Excel add-ins to extract city names from addresses?
+Yes, Excel provides several add-ins that can be used to extract city names from addresses, including Power Query and Power Pivot. These add-ins provide a range of functions and formulas that can be used to extract city names, making it easier to analyze and manipulate data.
In conclusion, extracting city names from addresses in Excel can be a challenging task, but with the right techniques and formulas, you can efficiently extract city names. By understanding address formats, using formulas and functions, and leveraging add-ins like Power Query and Power Pivot, you can make data analysis and manipulation easier. We hope this article has provided you with the necessary knowledge and skills to extract city names from addresses in Excel. If you have any further questions or need more assistance, please don't hesitate to comment below or share this article with your friends and colleagues.