If you want to extract right most word from a cell. Try this udf-
Function last_word(str1 As String)
Dim arr1
arr1 = Split(str1, " ")
last_word = arr1(UBound(arr1))
End Function
Steps to Use
- Copy the below code
- Press Alt+F11 to open VBA editor
- Paste it in any public module or module 1
- For example you want to extract right most word from cell A1 in Cell B1 . In B1 = last_word(A1)
No comments:
Post a Comment