Split text into different columns from the right

后端 未结 2 744
北恋
北恋 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条回答
  • 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.

    0 讨论(0)
  • 2021-01-17 02:25

    With data in A1, in B1 enter:

    =TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",999)),COLUMNS($A:A)*999-998,999))
    

    and copy across:

    0 讨论(0)
提交回复
热议问题