Extracting only date from cell containing text and date

jbhenry12

Board Regular
Joined
Nov 12, 2012
Messages
56
Hello,

I have numerous cells in column D that contain the text "anticipated by DATE" or "DATE - expected" Where there is DATE, there are actual dates.

Is there a formula that will pull out only the date in these cells? The dates appear in the beginning and the end of the text strings, so I cannot just use a formula that removes the first or last text in the cell since the text is not uniform throughout.

Any help is appreciated.

Thanks!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi,

Assuming that the date is in MM/DD/YYYY format,

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

If date is in MM-DD-YYYY format, replace / with -.

Jai
 
Upvote 0
Is it just those two phrases exactly or can there be a variety of text mixed in with the date?

If the former, you should just be able to use Replace to replace "anticipated by " with nothing and " - expected" with nothing. If the latter, you will need to post an example of precisely the format you are looking at.

Cheers, :)
 
Upvote 0
Shawnhet

This may be more complicated than I thought. I have text strings as follows...

Anticipated Vacancy 01/05/2012
Anticipated Vacancy 01/26/13; Promotion - Fill- duty station
Anticipated Vacancy TBD
Anticipated Vacancy June 2014

Ideally I would like to be able to pull back ONLY the following from all of these cells.

01/05/2012
01/26/13
TBD
June 2014


Is this even possible?


Thanks!
 
Upvote 0
Assuming every line starts with "Anticipated Vacancy " and we don't want anything after a semicolon. Try the following:

=MID(A1,21,IF(ISERROR(FIND(";",A1)),999,FIND(";",A1)-21))

Cheers, :)
 
Upvote 0
Ok, that worked. BUT, this column is a little bit of a hodge podge. There are other cells with text and dates (example below)

Current Grade: B+
BBA 04/16/2010 (w/ extra)

So, it is picking up stuff after the 21st character and returning that as well.

Is there a way to get this to work for only the cells that start with "Anticipated Vacancy" ?
 
Upvote 0
Not sure exactly what you're asking - if you only want the date for Anticipated vacancies this should work

=IF(ISERROR(FIND("Anticipated Vacancy",A1)),"",IF(FIND("Anticipated Vacancy",A1)=1,MID(A1,21,IF(ISERROR(FIND(";",A1)),999,FIND(";",A1)-21)),""))

This will leave a blank cell if A1 does not start with "Anticipated Vacancy"

If, OTOH, if you want to pull out all the dates from all lines, you will need to find a pattern in your data somewhere. If there is no pattern to the dates and no other pattern to the data there is probably not much you can do to get everything.

Cheers, :)

 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top