+ Reply to Thread
Results 1 to 6 of 6

Separate column after first space

  1. #1
    Registered User
    Join Date
    09-15-2006
    Posts
    31

    Separate column after first space

    Hi

    I need help to separate a column after the first space found.

    Example: "PC Need for speed" should be devided into to 2 columns with "PC" in one and "Need for speed" in another and "Xbox Fable lost chapters" should be "Xbox" and "Fable lost chapters"

    When I use text to columns it can only separate at every point it finds a space.

    Help please!

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Hi,

    In column B put

    =LEFT(A1,FIND(" ",A1)-1)

    In column C put

    =MID(A1,FIND(" ",A1)+1,9999)

    and formula fill as required.

    ---

    Quote Originally Posted by peter233
    Hi

    I need help to separate a column after the first space found.

    Example: "PC Need for speed" should be devided into to 2 columns with "PC" in one and "Need for speed" in another and "Xbox Fable lost chapters" should be "Xbox" and "Fable lost chapters"

    When I use text to columns it can only separate at every point it finds a space.

    Help please!

  3. #3
    Registered User
    Join Date
    09-15-2006
    Posts
    31
    Thank you so much!


    Quote Originally Posted by Bryan Hessey
    Hi,

    In column B put

    =LEFT(A1,FIND(" ",A1)-1)

    In column C put

    =MID(A1,FIND(" ",A1)+1,9999)

    and formula fill as required.

    ---

  4. #4
    Registered User
    Join Date
    09-15-2006
    Posts
    31
    Having som problem doing a loop with these functions and I cant figure out whats wrong.

    y = 5
    Do While IsEmpty(Sheets(1).Cells(y, 1)) = False
    Sheets(1).Cells(y, 3) = "=LEFT(B" & y & ";FIND("" """ & ";B" & y & ")-1)"
    Sheets(1).Cells(y, 4) = "=MID(B" & y & ";FIND("" """ & ";B" & y & ")+1;9999)"
    y = y + 1
    Loop

    I just get:
    Run-time error 1004
    Application-defined or object-defined error

    Help!

  5. #5
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    y = 5
    Do While IsEmpty(Sheets(1).Cells(y, 1)) = False
    Sheets(1).Cells(y, 3).Value = "=LEFT(B" & y & ",FIND("" """ & ",B" & y & ")-1)"
    Sheets(1).Cells(y, 4) = "=MID(B" & y & ",FIND("" """ & ",B" & y & ")+1,9999)"
    y = y + 1
    Loop


    doesn't error, but it may not do what you originally intended.

    ---


    Quote Originally Posted by peter233
    Having som problem doing a loop with these functions and I cant figure out whats wrong.

    y = 5
    Do While IsEmpty(Sheets(1).Cells(y, 1)) = False
    Sheets(1).Cells(y, 3) = "=LEFT(B" & y & ";FIND("" """ & ";B" & y & ")-1)"
    Sheets(1).Cells(y, 4) = "=MID(B" & y & ";FIND("" """ & ";B" & y & ")+1;9999)"
    y = y + 1
    Loop

    I just get:
    Run-time error 1004
    Application-defined or object-defined error

    Help!

  6. #6
    Forum Contributor
    Join Date
    11-11-2005
    Posts
    267
    Please Login or Register  to view this content.
    At first blush, change ; to comma(,)

    You don't really need a loop for this exercise. If you want to fill "C5:C"& (lastRow) with formula, simlpy go:

    Lastrw1=Cells(rows.count,"C").End(xlUp).Row
    Sheets(1).Range("C5:C" & Lastrw1)="=LEFT(B5,FIND("",B5)-1)

    Similarly,
    Lastrw2=Cells(rows.count,"D").End(xlUp).Row
    Sheets(1).Range("D5:D" & Lastrw2)="=MID(B5,FIND("",B5)+1,999)
    HTH
    Myles

    ...constantly looking for the smoother pebble while the whole ocean of truth lies before me.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1