ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I delete text to right of a comma in a range of cells? (https://www.excelbanter.com/excel-discussion-misc-queries/65194-how-do-i-delete-text-right-comma-range-cells.html)

Mike M.

How do I delete text to right of a comma in a range of cells?
 
I have a long list of addresses and need to separate out the city and state,
which got merged all into one cell. Need to import data into Streets and
Trips and want to delete all city and state info out of the address cells.
Please assist.

Mike

Ian

How do I delete text to right of a comma in a range of cells?
 
Select the column with your data in and ensure that ythe next column is
empty.
Go to DataText to Columns and choose delimited, then comma.
Assuming your data is in column A you should get city in A and state in B.
--
Ian
--
"Mike M." <Mike wrote in message
...
I have a long list of addresses and need to separate out the city and
state,
which got merged all into one cell. Need to import data into Streets and
Trips and want to delete all city and state info out of the address cells.
Please assist.

Mike




JMay

How do I delete text to right of a comma in a range of cells?
 
Here's a simple example using VBA -- Assumes there are NO BLANK cells in your
Range..

Select (or Highlight) the range of cells (say B5:g20)
then run this macro: (you've placed in a standard module).

Sub RemoveText()
Set MyRange = Selection
For Each c In MyRange
pos = WorksheetFunction.Find(",", c)
c.Value = Mid(c, 1, pos - 1)
Next c
End Sub

HTH,





"Ian" wrote in message
...
Select the column with your data in and ensure that ythe next column is empty.
Go to DataText to Columns and choose delimited, then comma.
Assuming your data is in column A you should get city in A and state in B.
--
Ian
--
"Mike M." <Mike wrote in message
...
I have a long list of addresses and need to separate out the city and state,
which got merged all into one cell. Need to import data into Streets and
Trips and want to delete all city and state info out of the address cells.
Please assist.

Mike







All times are GMT +1. The time now is 05:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com