+ Reply to Thread
Results 1 to 6 of 6

Grabbing certain characters from a mixed character cell

  1. #1
    Registered User
    Join Date
    05-01-2013
    Location
    Nevada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Grabbing certain characters from a mixed character cell

    I am trying to create a report where I need to change the format of a cell from reading a time such as "5 hr(s) 30 min(s)" or "6 hr(s)" and only grab the numbers to convert them to a decimal - 5.5 and 6. I created some crazy formula by using three columns and separating part of the cell using the LEFT command and then breaking it down which worked well if the cells had hr and min in the cell, but when it only had hrs, it obviously did not work. I need to create something that would be able to grab the numbers from the cell. I was thinking maybe, if there was a command in excel, I could use an if statement such as "if cell contains "min," do this, else... The problem is I don't know how to make excel recognize "contains."

    Could someone please help me??

    In desparate need of help for work, otherwise I have to manually convert everything myself.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Grabbing certain characters from a mixed character cell

    Show us SEVERAL representative examples so we can see what we're dealing with.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    05-01-2013
    Location
    Nevada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Grabbing certain characters from a mixed character cell

    This is a quick file I just made up to show all of the possibilities that would pop up on my report that runs. I just need the decimal format.
    Attached Files Attached Files
    Last edited by Canook05; 05-02-2013 at 09:54 PM.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Grabbing certain characters from a mixed character cell

    Try this...

    =IF(COUNTIF(B4,"*hr*"),LEFT(B4,FIND(" ",B4)))+(IF(COUNTIF(B4,"*min*"),SUBSTITUTE(RIGHT(B4,9),"min(s)",""))/60)

  5. #5
    Registered User
    Join Date
    05-01-2013
    Location
    Nevada
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Grabbing certain characters from a mixed character cell

    Oh my gosh THANK YOU SO MUCH!!! You just saved me about 5 hours of work!

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Grabbing certain characters from a mixed character cell

    You're welcome. Thanks for the feedback!

+ 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