Thủ Thuật
  • TOP Thủ Thuật
    • Thủ Thuật Internet
    • Thủ Thuật Máy Tính
    • Thủ Thuật Tiện Ích
    • Thủ Thuật Phần Mềm
  • Chia Sẻ Kiến Thức
    • Học Excel
    • Học Word
    • Học Power Point
  • Games
  • Kênh Công Nghệ
  • Facebook
  • WordPress
  • SEO
No Result
View All Result
Thủ Thuật
  • TOP Thủ Thuật
    • Thủ Thuật Internet
    • Thủ Thuật Máy Tính
    • Thủ Thuật Tiện Ích
    • Thủ Thuật Phần Mềm
  • Chia Sẻ Kiến Thức
    • Học Excel
    • Học Word
    • Học Power Point
  • Games
  • Kênh Công Nghệ
  • Facebook
  • WordPress
  • SEO
No Result
View All Result
Thủ Thuật
No Result
View All Result
Home Chia Sẻ Kiến Thức Học Excel

How to Separate Ward, District, and City from Addresses in Excel

How to Separate Ward, District, and City from Addresses in Excel
6k
SHARES
19.5k
VIEWS
Share on Facebook

Nội Dung Bài Viết

Toggle
  • Analyzing the Data Structure
  • Step 1: Locating the Split Point with the SEARCH Function
  • Step 2: Extracting the Administrative String with RIGHT and LEN
  • Step 3: Converting Formulas to Static Values
  • Step 4: Splitting Components with Text to Columns
  • Final Result and Conclusion
  • References

Handling raw data, particularly address lists, is a frequent challenge for data analysts and office administrators. You often receive a dataset containing full address strings—including house numbers, street names, wards, districts, and cities—all crammed into a single cell. The challenge arises when you need to filter or sort this data by specific administrative regions, requiring you to split these components into separate columns.

While Excel offers various tools for data manipulation, Vietnamese addresses present a unique difficulty due to inconsistent formatting. Some entries may use abbreviations (e.g., “P.7”, “Q Go Vap”, “Tp.HCM”), while others use full text (e.g., “Phuong”, “Quan”, “TP. Ho Chi Minh”). Furthermore, the character length of these addresses varies significantly, making standard fixed-width splitting impossible. This guide will demonstrate a professional, hybrid method using Excel functions and the “Text to Columns” tool to accurately separate Wards, Districts, and Cities.

Analyzing the Data Structure

Before applying any formulas, it is crucial to analyze the dataset to identify common patterns. In the example below, column A contains the full address strings. Our goal is to extract the administrative divisions (Ward, District, City) into columns C, D, and E.

Spreadsheet example showing the requirement to split full addresses into separate columns for Ward, District, and CitySpreadsheet example showing the requirement to split full addresses into separate columns for Ward, District, and City

The primary obstacle here is the inconsistency in how the street names and house numbers are separated from the administrative units. However, upon closer inspection of the data, a distinct “delimiter” or marker appears consistently across the entries.

To successfully separate the data, we must identify a unique character sequence that separates the “Street/House Number” part from the “Ward/District/City” part. In many Vietnamese address datasets, this separation is often marked by a comma followed by a space and the letter “P” (denoting “Phường” or Ward).

Animation illustrating the process of analyzing and selecting address data cells in ExcelAnimation illustrating the process of analyzing and selecting address data cells in Excel

Visualizing the text string helps confirm this pattern. By isolating the transition point, we can define the logic for our Excel formulas.

Close-up textual analysis highlighting the comma space and letter P as the separation pointClose-up textual analysis highlighting the comma space and letter P as the separation point

This specific sequence—, P (comma, space, P)—will serve as our anchor point. We can divide the address into two main segments:

  1. Left Segment: House number and street name.
  2. Right Segment: Ward, District, and City.
Xem thêm:  Phân tích Lưu Lượng Truy Cập Website Theo Khung Giờ trong Excel

Step 1: Locating the Split Point with the SEARCH Function

The SEARCH function is designed to locate the position of a specific text string within a larger string. It returns the numerical position of the first character of the found string. This is case-insensitive, which is advantageous if the data has inconsistent capitalization.

To find the start of the administrative section, we use the following formula:

=SEARCH(", P", A2)

Breakdown of the formula:

  • ", P": This is the specific text string we are looking for (comma + space + P).
  • A2: This is the cell containing the full address.

By applying this formula, Excel returns a number representing the character position where the Ward section begins. This number is the key to extracting the rest of the string.

Excel table showing the numerical results returned by the SEARCH function in a helper columnExcel table showing the numerical results returned by the SEARCH function in a helper column

Step 2: Extracting the Administrative String with RIGHT and LEN

Once we know where the administrative part starts, we need to extract everything to the right of that point. We achieve this by combining the RIGHT function with the LEN function.

The logic is straightforward: The number of characters we want to extract from the right side equals the Total Length of the string minus the Position of our split point.

The formula is:

=RIGHT(A2, LEN(A2) - B2)

Where:

  • LEN(A2): Calculates the total number of characters in the address cell.
  • B2: Is the position number we found in the previous step using SEARCH.
  • RIGHT(...): Extracts the characters from the end of the text string based on the calculated count.

This effectively discards the house number and street name, leaving us with a string containing only the Ward, District, and City.

Excel spreadsheet displaying the extracted administrative address text in a new columnExcel spreadsheet displaying the extracted administrative address text in a new column

Step 3: Converting Formulas to Static Values

Before we can split the extracted text into separate columns for Ward, District, and City, we must handle a critical technical detail. The results in column C are currently dynamic formulas. The “Text to Columns” feature works best on static text, not live formulas.

To fix this, we need to replace the formulas with their resulting values:

  1. Select the range containing the extracted text (e.g., C2:C5).
  2. Copy the cells (Ctrl + C).
  3. Right-click on the same selection and choose Paste Special.
  4. Select Values (indicated by the “123” icon).
Xem thêm:  Hướng Dẫn Tự Học VBA Trong Excel Với Record Macro

Context menu in Excel illustrating the Paste Values option to remove formulasContext menu in Excel illustrating the Paste Values option to remove formulas

This action disconnects the data from the original address column, allowing us to manipulate it freely without errors.

Step 4: Splitting Components with Text to Columns

Now that we have a clean string containing “Ward, District, City”, we can use Excel’s powerful Text to Columns wizard. This tool splits content based on a delimiter—in this case, the comma separating the administrative units.

Procedure:

  1. Select the range of data you just converted to values (C2:C5).
  2. Navigate to the Data tab on the Ribbon.
  3. Click on Text to Columns.

Excel ribbon interface highlighting the Data tab and Text to Columns buttonExcel ribbon interface highlighting the Data tab and Text to Columns button

A wizard will appear to guide you through the process:

  • Step 1 of 3: Choose Delimited. This tells Excel that our data is separated by specific characters (commas), not by fixed widths. Click Next.
  • Step 2 of 3: In the Delimiters section, check the box for Comma. You should see a preview of your data being separated into columns in the window below.

Text to Columns wizard step 2 showing the selection of Comma as the delimiterText to Columns wizard step 2 showing the selection of Comma as the delimiter

  • Step 3 of 3: You can format the columns if necessary, or simply click Finish.

Final Result and Conclusion

After clicking Finish, Excel will automatically distribute the Ward, District, and City into separate adjacent columns. You now have a structured dataset that can be easily sorted, filtered, or imported into other database systems.

Final Excel table showing Ward District and City successfully separated into individual columnsFinal Excel table showing Ward District and City successfully separated into individual columns

By combining logical functions (SEARCH, LEN, RIGHT) with standard data tools (Text to Columns), we have solved a complex formatting problem without needing advanced VBA coding. This approach demonstrates that understanding the structure of your data is just as important as knowing the functions themselves.

Key Takeaways:

  • Pattern Recognition: Always look for a consistent character sequence (like “, P”) to use as a “hook” for splitting data.
  • Hybrid Approach: Don’t rely on a single tool. Combining formulas for pre-processing and built-in tools for final execution is often the most efficient workflow.
  • Data Integrity: Always remember to convert formulas to values before performing destructive editing like “Text to Columns” to prevent data loss.

This method is highly scalable and can be adapted for other types of unstructured data cleaning, making it an essential skill for any Excel user.

References

  • Microsoft Support: Split text into different columns with the Convert Text to Columns Wizard
  • Microsoft Support: SEARCH, SEARCHB functions
  • Microsoft Support: LEN, LENB functions
Đánh Giá Bài Viết
Tuyết Nhi

Tuyết Nhi

Tôi là Tuyết Nhi - Nữ phóng viên trẻ đến từ Hà Nội. Với niềm đam mê công nghệ, khoa học kỹ thuật, tôi yêu thích và muốn chia sẻ đến mọi người những trải nghiệm, kinh nghiệm về các lĩnh vực công nghệ, kỹ thuật... Rất mong được quý độc giả đón nhận ❤️.

Related Posts

Mastering the Excel AND Function: A Comprehensive Guide to Logical Formulas
Học Excel

Mastering the Excel AND Function: A Comprehensive Guide to Logical Formulas

How to Calculate and List All Sundays in a Month Using Excel
Học Excel

How to Calculate and List All Sundays in a Month Using Excel

How to Hide and Unhide Sheet Tabs in Excel: Complete Guide
Học Excel

How to Hide and Unhide Sheet Tabs in Excel: Complete Guide

Mastering Excel for Accounting: Building a Dynamic Accounts Receivable Summary Report
Học Excel

Mastering Excel for Accounting: Building a Dynamic Accounts Receivable Summary Report

Discussion about this post

Trending.

Trích Xuất Dữ Liệu từ Báo Cáo Power BI Đã Xuất Bản Trên Web

Trích Xuất Dữ Liệu từ Báo Cáo Power BI Đã Xuất Bản Trên Web

Hướng Dẫn Cách Livestream Trên Facebook Bằng Điện Thoại Và Máy Tính Đơn Giản, Sắc Nét Từ A-Z

Hướng Dẫn Cách Livestream Trên Facebook Bằng Điện Thoại Và Máy Tính Đơn Giản, Sắc Nét Từ A-Z

Download Your Uninstaller Pro 7.5 Full Key 2025 – Giải Pháp Gỡ Cài Đặt Phần Mềm Tận Gốc

Download Your Uninstaller Pro 7.5 Full Key 2025 – Giải Pháp Gỡ Cài Đặt Phần Mềm Tận Gốc

Day R Premium MOD APK: Sinh tồn hậu tận thế trên di động

Day R Premium MOD APK: Sinh tồn hậu tận thế trên di động

Hướng Dẫn Tích Hợp Akismet Vào Contact Form 7: Giải Pháp Chống Spam “Tàng Hình” Hiệu Quả Nhất

Hướng Dẫn Tích Hợp Akismet Vào Contact Form 7: Giải Pháp Chống Spam “Tàng Hình” Hiệu Quả Nhất

Giới Thiệu

Thủ Thuật

➤ Website đang trong quá trình thử nghiệm AI biên tập, mọi nội dung trên website chúng tôi không chịu trách nhiệm. Bạn hãy cân nhắc thêm khi tham khảo bài viết, xin cảm ơn!

Chuyên Mục

➤ TOP Thủ Thuật

➤ Chia Sẻ Kiến Thức

➤ Kênh Công Nghệ

➤ SEO

➤ Games

Liên Kết

➤ Ketquaxskt.com

➤ TOP Restaurants

➤ Here Restaurant

➤

➤

Liên Hệ

➤ TP. Hải Phòng, Việt Nam

➤ 0931. 910. JQK

➤ Email: [email protected]

Website này cũng cần quảng cáo, không có tiền thì viết bài làm sao  ” Đen Vâu – MTP ”

DMCA.com Protection Status

© 2025 Thủ Thuật - Website chia sẻ kiến thức công nghệ hàng đầu Việt Nam

No Result
View All Result
  • TOP Thủ Thuật
    • Thủ Thuật Internet
    • Thủ Thuật Máy Tính
    • Thủ Thuật Tiện Ích
    • Thủ Thuật Phần Mềm
  • Chia Sẻ Kiến Thức
    • Học Excel
    • Học Word
    • Học Power Point
  • Games
  • Kênh Công Nghệ
  • Facebook
  • WordPress
  • SEO

© 2025 Thủ Thuật - Website chia sẻ kiến thức công nghệ hàng đầu Việt Nam