-5

How can I put a comma without a formula in 60k contacts. I need to separate the street number to street name. It so hard for me to do it manually. After I put a comma to the address I will separate them in column. Just like this

https://i.stack.imgur.com/5b3B2.jpg https://i.stack.imgur.com/ARSdd.jpg

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
  • So you are asking same question as your previous one [here](https://stackoverflow.com/questions/45856180/formula-to-input-a-comma-in-excel) only difference being you don't want to use formula this time. However you should also accept answers of your previous questions if it solves your problem. – Mrig Aug 26 '17 at 07:36
  • Yes, It helps me a lot this time no formula. – Jonna Luciano Aug 26 '17 at 09:39
  • Even solution provided for your previous question was as per the question and should have been accepted which you did and unaccepted again. Dont understand why. – Mrig Aug 26 '17 at 09:42
  • 1
    You cannot without using VBA. Develop your code, and post back with your code and any specific problems you have in implementing it. – Ron Rosenfeld Aug 26 '17 at 09:58

2 Answers2

0

Assuming address starts with street number followed by space and then rest of the address, following should be helpful.

Sub Demo()
    Dim ws As Worksheet
    Dim i As Long

    Set ws = ThisWorkbook.Sheets("Sheet1")  'change Sheet1 to your data sheet

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
    With ws
        lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row    'get last row in Column A
        For i = 2 To lastrow
            .Range("B" & i).Formula = Evaluate("=SUBSTITUTE(A" & i & ","" "","", "",1)")
        Next i
    End With
    Application.ScreenUpdating = True
    Application.Calculation = xlCalculationAutomatic
End Sub

enter image description here

Mrig
  • 11,612
  • 2
  • 13
  • 27
0

You could loop through the H column and in every cell replace the first space by a comma, using a vba routine.

Sub Addcomma()

Dim i As Integer

With ActiveSheet
For i = 2 To .Cells(.Rows.Count, "H").End(xlUp).Row
.Cells(i, 8) = Replace(.Cells(i, 8), " ", ",", , 1)
Next
End With

End Sub

After that you can use the text-to-columns function, using a comma as the delimiter.

Marco Vos
  • 2,888
  • 1
  • 9
  • 10
  • Try this [link](https://www.ablebits.com/office-addins-blog/2013/12/06/add-run-vba-macro-excel/) It points a tutorial for beginners:How to insert and run VBA code in Excel. – Marco Vos Aug 26 '17 at 09:52