+ Reply to Thread
Results 1 to 12 of 12

VBA Code to split cell's text data

  1. #1
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    VBA Code to split cell's text data

    Hey Team,

    I have a macro that give file location in Column F. I want to split cell's data of column F between last two backslash. First splitted data should go to Column E and last to column A but without .xlsx. Location format would be same for all entire column F.

    Also column A is a name and there is a email database in sheet "Email ID data" . We also need to identify email ID for each of entry in column A.

    I have attached sample sheet. Please look into this for reference. Please help on this.

    Thanks,
    Liz
    Attached Files Attached Files
    Last edited by Liz_Biz; 09-13-2014 at 03:24 PM.

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA Code to split cell's text data

    Hi,
    Here is macro that
    split value in column F
    populate column A
    Populate column E
    populate B with VLOOKUP formula that retrieves data from the other sheet

    Please Login or Register  to view this content.
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA Code to split cell's text data

    See attached. You don't need macros. Columns A & E contain formulae to do the job for you.

    And of course a standard VLOOKUP will get you the email address onto the EMail ID Data sheet - or indeed an Advanced Data Filter.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: VBA Code to split cell's text data

    Thanks Buran for quick response !!

    Is it possible to split path like "C:\Documents and Settings\liz\Desktop\INST\UID_August_Baker,Edward D.xlsx" into two parts?
    Name (Column A) "Baker,Edward D" and Subject (Column E) "UID_August". Rest condition would be same.

    Also we can't use vlookup as this fails once it search same value again.

  5. #5
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: VBA Code to split cell's text data

    Thanks Rich !!

    You solution is pretty nice. But my colleagues are quite lazy. Its pretty tough for them to learn how to use formula.

    Thanks again for your solution.

  6. #6
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA Code to split cell's text data

    Quote Originally Posted by Liz_Biz View Post
    Is it possible to split path like "C:\Documents and Settings\liz\Desktop\INST\UID_August_Baker,Edward D.xlsx" into two parts?
    Name (Column A) "Baker,Edward D" and Subject (Column E) "UID_August". Rest condition would be same.
    Yes, it's possible but you should specify where to split (e.g. at last underscore)

    Quote Originally Posted by Liz_Biz View Post
    Also we can't use vlookup as this fails once it search same value again.
    I don't understand waht you mean with that. Can you explain further. You can always convert formula to value...

  7. #7
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: VBA Code to split cell's text data

    Yes. It's last underscore.

    Sorry !! vlookup is working fine. Can we remove this vlookup formula and past only value?

  8. #8
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA Code to split cell's text data

    test this if it works

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: VBA Code to split cell's text data

    Buran,

    I am getting underscore at the end and start of split data (column A & E). Also vlookup is not working due to underscore and .xlsx in column A.

    Thanks,
    Liz
    Attached Files Attached Files
    Last edited by Liz_Biz; 09-13-2014 at 03:10 PM.

  10. #10
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA Code to split cell's text data

    Sorry, now it should be OK
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    12-19-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: VBA Code to split cell's text data

    You solved it very fast!!

    Thank you buran !!

  12. #12
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: VBA Code to split cell's text data

    Great, don't forget to mark thread as [SOLVED]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Split data with vba code after every comma.
    By a1b2c3d4e5f6g7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-28-2014, 11:50 AM
  2. VB Code to split the text String
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-25-2013, 10:21 AM
  3. [SOLVED] VB Code to split data
    By Oszie in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-27-2013, 08:37 AM
  4. how to convert excel split code to word split code
    By gsrikanth in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-02-2012, 07:56 AM
  5. Mod code to split text
    By karinos57 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2007, 10:27 PM

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