Split text into different columns from the right

后端 未结 2 832
北恋
北恋 2021-01-17 02:11

I have a string of alpha-numeric text that is in one cell of Excel, using v2016. the text is similar to:

ECN 6120 012 MMR 12195 201481

I have u

2条回答
  •  萌比男神i
    2021-01-17 02:18

    You could use a UDF to do this.

    In VBE, create a new module and drop this code in:

    Function strtok(strIn As String, strDelim As String, intToken As Integer) As String
       strtok = Split(strIn, strDelim)(intToken - 1)
    End Function
    

    You can use this on your sheet then by using formula:

    =strtok(A1, " ", 4) 
    

    To get the 4th word in that cell.

提交回复
热议问题