Consulting

Results 1 to 6 of 6

Thread: Solved: trim function.

  1. #1

    Solved: trim function.

    In range a2 to a and lastrow, I have data which is seperated by "_" for example

    a2 = London_Mark_123145
    a3 = Manchester_Matthew_123

    i want b2 = London
    i want c2 = Mark
    i want d2 = 123145

    i want b3 = Manchester
    i want c3 = Matthew
    i want d3 = 123

    Can anyone help

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Use Data>Text To Columns with a delimiter of _.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    I need to code it... xld..

  4. #4
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    I see that you said code, this is just in case a formula would be okay, as well as practice for me. I would expect that at least teh second formula may be less than stellar.

    In B2:  =TRIM(LEFT(A2,FIND("_",A2,1)-1))
    In C2:  =TRIM(MID(A2,FIND("_",A2,1)+1,FIND("_",A2,FIND("_",A2)+1)-FIND("_",A2,1)-1))
    In D2:  =MID(A2,FIND("_",A2,FIND("_",A2)+1)+1,255)
    Mark

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Then code the TExt To columns, do it in Excel with the macro recorder on.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    thanks xld ,, was having a dim moment

Posting Permissions

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