Excel function to get first word from sentence in other cell

后端 未结 5 1097
孤城傲影
孤城傲影 2020-12-31 07:39

Excel: What function can I use to take the all the characters from the beginning to the first \'<\". I am trying to strip out the first word from A1 and put it into B1

5条回答
  •  不思量自难忘°
    2020-12-31 08:03

    Generic solution extracting the first "n" words of refcell string into a new string of "x" number of characters

    =LEFT(SUBSTITUTE(***refcell***&" "," ",REPT(" ",***x***),***n***),***x***)
    

    Assuming A1 has text string to extract, the 1st word extracted to a 15 character result

    =LEFT(SUBSTITUTE(A1&" "," ",REPT(" ",15),1),15)
    

    This would result in "Toronto" being returned to a 15 character string. 1st 2 words extracted to a 30 character result

    =LEFT(SUBSTITUTE(A1&" "," ",REPT(" ",30),2),30)
    

    would result in "Toronto is" being returned to a 30 character string

提交回复
热议问题