Probably the most versitile way to do this is with a UDF.
This will clear any amount of characters outwith delimiters < and >
Function TrimCell(rng As Range)
Dim strTemp As String
Dim n As Long
Dim switch As Boolean
For n = 1 To Len(rng)
If Not switch Then
If Mid(rng, n, 1) = "<" Then
strTemp = strTemp & Mid(rng, n, 1)
switch = True
Else
strTemp = strTemp & ""
End If
Else
If Mid(rng, n, 1) = ">" Then
strTemp = strTemp & Mid(rng, n, 1)
switch = False
Else
strTemp = strTemp & Mid(rng, n, 1)
End If
End If
Next
TrimCell = strTemp
End Function
Use in Excel
Formula:
=TrimCell(A2)
See this workbook
Bookmarks