我需要合并来自4,000+商店地址列表中的“邮政编码”的“城市,州”(下面的小示例)。
我需要做什么才能将只有"City,State Zip“的单元格分成两列,其中一列有"City,State”,另一列有"Zip“,而忽略所有其他单元格?
Bel Air
3436 Bel Air Mall
Mobile, AL 36606
Bridge Street
330 The Bridge Street
Huntsville, AL 35806
Colonial Mall Auburn
1627 Opelika Road
Auburn, AL 36830
Eastchase
6850 Eastchase Parkway
Montgomery, AL 36117
Eastern Shore Centre
30500 Highway 181
Spanish Fort, AL 36527
Gadsden
1001 Rainbow Drive
Gadsden, AL 35901 发布于 2020-06-06 12:00:16
这里有一些有效的代码。假设您的地址位于excel表格的"A“列中。并且它们都遵循与示例相同的格式
Sub split_out_zip()
For x = 1 To Range("A" & Rows.Count).End(xlUp).Row
Line = trim(Cells(x, "A"))
If InStr(Line, ",") Then
zip = Right(Line, 5)
cityState = Left(Line, Len(Line) - 5)
Cells(x, "B") = cityState
Cells(x, "C") = zip
End If
Next x
End Sub这将在B和C列中输出它
https://stackoverflow.com/questions/62224731
复制相似问题