+ Reply to Thread
Results 1 to 4 of 4

Extracting Date from text and formatting to date

  1. #1
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    170

    Extracting Date from text and formatting to date

    Hello all!

    I'm working with a report where data is all formatted as text. I need to extract the date out of a string of text, and then format it to be a date. Example: Cell C4 "Joe Smith Statement Period: Feb 08 2016-Mar 07 2016".

    I can separate the actual numbers out, but excel doesn't recognize them as dates. Here are the formulas that I'm using / have tried.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    - returns "Feb 08 2016-Mar 07 2016"

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    - returns "Feb 08 2016"

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    - returns "Mar 07 2016"

    These three all work great. However, simply changing the formatting of the cell to date doesn't do anything. So I tried the following formulas to change the text to date.

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

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

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

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


    None of these are working, they all return an error of "#VALUE".

    Any ideas?

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting Date from text and formatting to date

    Enter formula in D4 and copy across

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


    Format cells D4 and E4 as Date.

    v C D E
    1
    2
    3
    4 Joe Smith Statement Period: Feb 08 2016-Mar 07 2016 2/8/2016 3/7/2016
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Extracting Date from text and formatting to date

    The issue is that Excel only sees it as a date if there is a comma between the day and year. These formulas should work for you (I made them a little more versatile.

    In D4 (date range as text)
    =TRIM(RIGHT(C4, LEN(C4)-FIND(":",C4)))

    In E4 (first date)
    =SUBSTITUTE(TRIM(LEFT(D4, SEARCH("-",D4)-1))," ", ", ",2)+0

    In F4 (second date)
    =SUBSTITUTE(TRIM(MID(D4, FIND("-",D4)+1,50))," ", ", ", 2)+0
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Contributor
    Join Date
    05-31-2013
    Location
    Philadelphia, Pa
    MS-Off Ver
    Excel 2010
    Posts
    170

    Re: Extracting Date from text and formatting to date

    Perfect solution! Thanks.

+ 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. [SOLVED] trouble extracting date from a text string
    By z0rdd in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-01-2015, 10:29 AM
  2. [SOLVED] Extracting a date from text in a cell
    By gedwards913 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-22-2015, 08:09 AM
  3. [SOLVED] Extracting the date from a text string and then UN-reversing it...
    By TommyK25 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-31-2014, 11:59 AM
  4. Excel 2013 – need help extracting date and time from text cell plus more.
    By Art Mann in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-18-2014, 10:55 AM
  5. Extracting last date in text string
    By mmaya4 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2014, 01:45 PM
  6. [SOLVED] Extracting numbers from text and converting into a date
    By ciapul12 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-15-2014, 07:01 PM
  7. Extracting a Date from a text string
    By andrewc in forum Excel General
    Replies: 6
    Last Post: 09-22-2009, 06:44 AM

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