+ Reply to Thread
Results 1 to 6 of 6

Formula / Code to find date within strings

  1. #1
    Registered User
    Join Date
    07-08-2015
    Location
    Philippines
    MS-Off Ver
    2007
    Posts
    9

    Formula / Code to find date within strings

    Hi Guys,

    Can you give me formula or code to find the date within strings then replace it with blank. Below is the sample the 2nd column is the output data.

    Original Data New Data
    ADMISSION DATE 01/01/2016 ER CASE ADMISSION DATE ER CASE
    ARRIVED/ 12/31/2015 ER CASE ARRIVED/ ER CASE
    ADMISSION DATE 01/01/2016 ADMISSION DATE
    RELEASED DATE: 01/02/2015 ER CASE RELEASED DATE: ER CASE
    ADMISSION DATE: 01/20 ADMISSION DATE:
    RELEASED: 01/20 RELEASED
    Attached Files Attached Files

  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: Formula / Code to find date within strings

    I didn't download your file.

    This monster formula works on the posted sample data...

    Data Range
    A
    B
    C
    2
    ADMISSION DATE 01/01/2016 ER CASE
    ------
    ADMISSION DATE ER CASE
    3
    ARRIVED/ 12/31/2015 ER CASE
    ------
    ARRIVED/ ER CASE
    4
    ADMISSION DATE 01/01/2016
    ------
    ADMISSION DATE
    5
    RELEASED DATE: 01/02/2015 ER CASE
    ------
    RELEASED DATE: ER CASE
    6
    ADMISSION DATE: 01/20
    ------
    ADMISSION DATE:
    7
    RELEASED: 01/20
    ------
    RELEASED:


    This formula entered in C2 and copied down:

    =TRIM(SUBSTITUTE(SUBSTITUTE(A2,TEXT(LOOKUP(1E100,--MID(A2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&1234567890)),ROW(INDIRECT("1:"&LEN(A2))))),"mm/dd/yyyy"),""),TEXT(LOOKUP(1E100,--MID(A2,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&1234567890)),ROW(INDIRECT("1:"&LEN(A2))))),"mm/dd"),""))
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Formula / Code to find date within strings

    May Be

    =TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE( SUBSTITUTE(A2,1,""),2,""), 3,""),4,""),5,""), 6,""),7,""),8,""),9,""),0,""),"/",""))
    Last edited by shukla.ankur281190; 02-23-2016 at 06:45 AM. Reason: Changes as suggested Post#4
    If I helped, Don't forget to add reputation (click on the little star ★ at bottom of this post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

  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: Formula / Code to find date within strings

    Tip...

    You don't need to quote the numbers.

    Also, you need to add a TRIM function to get rid of the double spaces in some of the cells.

  5. #5
    Forum Expert shukla.ankur281190's Avatar
    Join Date
    05-17-2014
    Location
    Lucknow, India
    MS-Off Ver
    Office 365
    Posts
    3,935

    Re: Formula / Code to find date within strings

    Thanks for Tip Mr. Tony

  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: Formula / Code to find date within strings

    You're welcome!

+ 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. Deleted
    By la_chua29 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-18-2015, 12:55 PM
  2. Replies: 5
    Last Post: 04-28-2012, 01:54 AM
  3. Replies: 1
    Last Post: 10-18-2010, 06:32 PM
  4. Replies: 5
    Last Post: 07-15-2009, 10:59 AM
  5. VBA Code to find and apply formatting to specific text strings
    By chozen86 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2008, 01:20 AM
  6. How to find number of pairs of strings from list of strings?
    By greg_overholt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-27-2006, 06: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