Need urgent help in excel .

New Contributor

Column A has same value but column B has different value . 

e.g. 236445 has 3 different email ID . can some one help me to put those columns in different columns     
I need it as below . Can anyone help ?        
3 Replies


Here is a macro:

Sub MoveB()
    Dim r As Long
    Dim m As Long
    Dim c As Long
    Application.ScreenUpdating = False
    m = Cells(Rows.Count, 1).End(xlUp).Row
    c = 2
    For r = 2 To m
        If Cells(r, 1).Value = Cells(r - 1, 1).Value Then
            c = c + 1
            Cells(r, 2).Cut Destination:=Cells(r, c)
            c = 2
        End If
    Next r
    ' Optional
    Application.ScreenUpdating = True
End Sub

@Hans Vogelaar  can this be possible on excel ?  I do not know macros 


Press Alt+F11 to activate the Visual Basic Editor.

Select Insert > Module to create a new code module.

Copy the code from my previous reply and paste it into the module.

With the insertion point anywhere in the code, press F5 to run the macro.

Switch back to Excel to view the result.

If you want to keep the macro, save the workbook as a macro-enabled workbook (.xlsm)