+ Reply to Thread
Results 1 to 8 of 8

Copying Text Right of Specific Character

  1. #1
    Registered User
    Join Date
    09-29-2008
    Location
    Honolulu
    Posts
    4

    Copying Text Right of Specific Character

    I have an Excel sheet where the information in column A are basically fomatted as such.

    a1b2c3d4:abcd:1234

    My goal is to have Excel take the characters after the right most colon and put them in column B. In this case it would be 1234.
    However the problem for me is that the information in column A are always somewhat different, for example these could be 5 different entries in column A along with what I want to be in Column B.

    ab:cdef = cdef
    abcdef:12345:abc = abc
    123:a1b2c3:1a2b3c:abc:456 = 456
    abc:def:123456789 = 123456789
    abcd = abcd

    Notice also is that in the last example, there are no colons, so what I want in column B is basically the info in A itself.

    Does anyone know how this can be done?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525
    Hi LevinTrueno,

    Welcome to the forum.

    Though you've posted this in the Worksheet Functions area, the only way I could think of was to write the following macro to do the job:

    Please Login or Register  to view this content.
    Just change the starting row (i.e. B2) to suit.

    HTH

    Robert

  3. #3
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848
    The following formula should do what you want:
    Please Login or Register  to view this content.
    If any of your cells contain underscores, you can change the underscores in the formula o a character that won't appear in the cell you are checking such as | (shift backslash)

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    If a UDF is an acceptable solution, then
    Please Login or Register  to view this content.
    Usage is =PastLastColon(A1)
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    09-29-2008
    Location
    Honolulu
    Posts
    4
    Thanks everyone!

    mbdct, could I ask you to do a quick break down for me of that function you shared? I'm trying to learn Excel on the fly.

  6. #6
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    848
    Please Login or Register  to view this content.
    Checks if there is a ":" in the cells. If there is no : the result is an error and the cell itself is returned.

    Please Login or Register  to view this content.
    calculates the number of :s in the cell


    Please Login or Register  to view this content.
    changes out the last : for an underscore ( _ ).

    Please Login or Register  to view this content.
    Finds the location of the underscore and adds 1 to that position to get the location of the first character after the underscore (or the last : that it had replaced)

    The ,99) part of the MID() function makes sure the remainder of the cell is returned

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Here's another formula approach for data in A1

    =REPLACE(A1,1,LOOKUP(2^15,FIND(":",":"&A1,ROW(INDIRECT("1:"&LEN(A1)))))-1,"")

  8. #8
    Registered User
    Join Date
    09-29-2008
    Location
    Honolulu
    Posts
    4
    Thanks everyone!

+ 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. Copying Specific Data To Another Sheet
    By vmc62 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 05-06-2013, 08:57 AM
  2. How to sum specific value that contains text.
    By a94andwi in forum Excel General
    Replies: 2
    Last Post: 08-19-2008, 04:07 PM
  3. remove text after and before specific words
    By Statsman in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-22-2008, 02:38 PM
  4. Searching for Specific Text in a Row
    By NewExcelUser in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-06-2007, 10:22 PM
  5. Importing Text File - How to Use Specific Filter
    By jasoncw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2007, 07:06 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