Good Morning,
I have some data below
A1 -> TEST - 123 - 965A
A2 -> TEST - 111 - 656 - 965ASD
I need to break it so it looks like this
B1 -> 965A
B2 -> 965ASD
I need to fetch the 20 characters after the last "-"
Can be VBA or formula.
Printable View
Good Morning,
I have some data below
A1 -> TEST - 123 - 965A
A2 -> TEST - 111 - 656 - 965ASD
I need to break it so it looks like this
B1 -> 965A
B2 -> 965ASD
I need to fetch the 20 characters after the last "-"
Can be VBA or formula.
Code:Option Explicit
Sub test()
Dim c As Range
Dim s
For Each c In Columns(1).SpecialCells(2)
s = Split(c.Value, "-")
c.Offset(, 1).Value = s(UBound(s))
Next
End Sub
Good code, mana.
But I would use spaces around the dash in the Split parameterOr Trim the returnCode:s = Split(c.Value, " - ")
Probably best to Trim the return so some typo leaving out the Space won't kill the code.Code:s = Trim(Split(c.Value, "-"))
Good afternoon,
Thank you very much, it was very good.