+ Reply to Thread
Results 1 to 9 of 9

extract a date from a text string

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    Auckland, NZ
    MS-Off Ver
    2013
    Posts
    14

    extract a date from a text string

    Hi all. I have a sheet with a description that includes a date and time. I'd like to be able to pull the date out the string and populate a new column.
    there is no consistent number of characters before the date, but all dates have the same format

    the text strings look like this for example (I changed real names to fake ones... the rest of the data is as it is):

    TMV for: Name IsHere 08/04/2016 10:15: Name to Westwave. Return to pick up and take home
    TMV for: Another Person 08/04/2016 10:30: Another out for drive and coffee
    TMV for: Someone Else 08/04/2016 11:00: Someone for shopping and return to John Doe Rd


    any ideas???

    thanks, Theo.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,363

    Re: extract a date from a text string

    Try

    Data in A1

    =MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),MAX(IF(ISNUMBER(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))),ROW(INDIRECT("1:"&LEN(A1)))))-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")-1))+0

    Enter with Ctrl+Shift+Enter

    Copy down

  3. #3
    Registered User
    Join Date
    01-13-2016
    Location
    Auckland, NZ
    MS-Off Ver
    2013
    Posts
    14

    Re: extract a date from a text string

    thanks John- sorry- I put a text string in A1 and place the formulae in B1. I get a #VALUE! error can you explain the 'Enter with Ctrl+Shift+Enter' that might be the issue..
    such a fast reply- really appreciate it

    Theo

  4. #4
    Registered User
    Join Date
    01-13-2016
    Location
    Auckland, NZ
    MS-Off Ver
    2013
    Posts
    14

    Re: extract a date from a text string

    thanks John- sorry- I put a text string in A1 and place the formulae in B1. I get a #VALUE! error can you explain the 'Enter with Ctrl+Shift+Enter' that might be the issue..
    such a fast reply- really appreciate it

    Theo

  5. #5
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: extract a date from a text string

    try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    with Control+Shift+Enter

    data start in A1

  6. #6
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: extract a date from a text string

    If you want date as real date not as text, try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    (with Control+Shift+Enter) but cells should be formatted as DATE (short, long , whatever)

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,363

    Re: extract a date from a text string

    Try Sandy's formula - works fine.

    CSE: Hold down Ctrl+Shift together then (hit!) Enter

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,363

    Re: extract a date from a text string

    or

    =MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),10)+0

    Just enter

    Format cells as date

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

    Re: extract a date from a text string

    Try this...

    Data Range
    A
    B
    1
    TMV for: Name IsHere 08/04/2016 10:15: Name
    8/4/2016
    2
    TMV for: Another Person 08/04/2016 10:30: Another
    8/4/2016
    3
    TMV for: Someone Else 08/04/2016 11:00: Someone
    8/4/2016


    This formula entered in B1:

    =--MID(A1,FIND("/",A1)-2,10)

    Format as Date

    Copy down as needed
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Excel Extract Year from Text String Date
    By Ankit_Kumar in forum Excel General
    Replies: 2
    Last Post: 07-15-2015, 12:16 AM
  2. [SOLVED] Find and extract text string from within another text string
    By huy_le in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-12-2013, 03:22 PM
  3. [SOLVED] Extract time from date and time text string
    By pattem2013 in forum Excel General
    Replies: 5
    Last Post: 09-07-2013, 03:20 AM
  4. [SOLVED] Extract Text from String then Convert to a Date (Month/Year)
    By sgrey24 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-14-2013, 06:11 PM
  5. [SOLVED] How to Extract A Number from String if Text within the String Equals XYZ
    By tyrsfury in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 11-15-2012, 03:30 PM
  6. [SOLVED] extract text string when you only know the last three letters of that string
    By alison0edwards in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-12-2012, 01:20 PM
  7. Extract small string of text from larger string
    By mark_jam3s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2010, 05:36 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