Your formula in column B is:-
="Tab " & LEFT(SUBSTITUTE(A2," "," ",1),LEN(SUBSTITUTE(A2," "," ",1))-4)
If you want to use a macro to do this on all of column A then:-
Sub Macro1()
LR = Selection.SpecialCells(xlCellTypeLastCell).Row
Range("B2:B" & LR).FormulaR1C1 = _
"=IF(RC[-1]="""","""",""Tab "" & LEFT(SUBSTITUTE(RC[-1],"" "","" "",1),LEN(SUBSTITUTE(RC[-1],"" "","" "",1))-4))"
Selection.Copy
Range("B2:B" & LR).Value = Range("B2:B" & LR).Value
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Selection.Columns.AutoFit
Range("A1").Select
End Sub
Bookmarks