+ Reply to Thread
Results 1 to 7 of 7

Formula to split cell text based on specific characters

  1. #1
    Registered User
    Join Date
    03-06-2018
    Location
    Hartford
    MS-Off Ver
    2013
    Posts
    7

    Formula to split cell text based on specific characters

    Hello,
    I have a column of time duration (in general formatting) like below that I need to split into three columns for hour, minutes and seconds to be able to filter/work with numbers. Not every cell has all three "fields" however, so I would need the numbers to land in the right column. Is there a formula that can help do this?

    what I have:
    2h 48m 15s
    28m
    11m 31s
    2h 15m 21s
    7h 1m 29s
    13m 10s
    16m 39s
    42s


    What I need:
    Hours Minutes Seconds
    2 48 15
    28
    11 31
    2 15 21
    7 1 29
    13 10
    16 39
    42
    Thank you!

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula to split cell text based on specific characters

    One approach, assuming your strings in A1 onwards:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-06-2018
    Location
    Hartford
    MS-Off Ver
    2013
    Posts
    7

    Re: Formula to split cell text based on specific characters

    Genius!!! Thank you so much for the quick solution!!

  4. #4
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Formula to split cell text based on specific characters

    No problem; if you wanted to just to convert to a single-cell Time value in one go you could use an adaptation of the same:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Formula to split cell text based on specific characters

    Formulas for B1 to D1

    =IF(ISERROR(FIND("h",A1)),"",LEFT(A1,FIND("h",A1)-1))

    =IF(ISERROR(FIND("m",A1)),"",IF(ISERROR(FIND("h",A1)),LEFT(A1,FIND("m",A1)-1),MID(A1,FIND("h",A1)+2,FIND("m",A1)-FIND("h",A1)-2)))

    =IF(ISERROR(FIND("s",A1)),"",IF(ISERROR(FIND("m",A1)),LEFT(A1,FIND("s",A1)-1),MID(A1,FIND("m",A1)+2,FIND("s",A1)-FIND("m",A1)-2)))
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  6. #6
    Registered User
    Join Date
    03-06-2018
    Location
    Hartford
    MS-Off Ver
    2013
    Posts
    7

    Re: Formula to split cell text based on specific characters

    This is awesome, too - thank you so much for your help!

  7. #7
    Registered User
    Join Date
    03-06-2018
    Location
    Hartford
    MS-Off Ver
    2013
    Posts
    7

    Re: Formula to split cell text based on specific characters

    Thank you for this! These formulas also work

+ 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 column/cell on specific text
    By tstackhouse10 in forum Excel General
    Replies: 2
    Last Post: 11-14-2017, 03:27 PM
  2. Split text in single cell to multiples of 80 characters by full words
    By NotSwank in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-19-2014, 10:28 AM
  3. [SOLVED] Adding text to a cell based on specific text characters in another cell
    By JohnnyBoyxxx in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-29-2014, 06:03 PM
  4. Remove Specific Characters From Text Cell
    By chasfh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-18-2014, 10:38 AM
  5. Excel formula to split words with characters limit per cell
    By montroseite in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-06-2014, 07:22 AM
  6. Replies: 1
    Last Post: 08-17-2011, 05:59 AM
  7. Searching for Text String and copying specific portion based on characters
    By undergraduate in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-30-2010, 12:45 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