Split sentence

  • Hi!

    I have a sentence that i want to split after the first word. I have the sentence in column A. I want the first word i column A and the rest of the sentence in column B. I´ve tried to do it with "Text to columns" but then i get too many columns, one for every blank...

    I hope you guys can help me!

  • Hi ComaGlove

    From memory, the following code is there or there abouts. It can be done a lot more elegantly though.

    for i = 1 to 20
    let testString = activesheet.cells(i,1).value
    for j = 1 to len(testString)
    if mid(testString, j,1) = " " then
    let activesheet.cells(i,1).value = left(testString,j)
    let activesheet.cells(i,2).value = right(testString,len(testString)-j)
    goto nextRow
    end if
    next j
    next i


  • Hi, ComaGlove

    I hope the following set of formula will help you to do what you want.
    If you have your sentence in Col A then
    =IF(COUNTA(A1),LEFT(A1,FIND(" ",A1,1)-1),"")


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!