Posted to microsoft.public.excel.worksheet.functions
|
|
extract date from text
On Fri, 28 Nov 2008 14:27:41 -0600, Chip Pearson wrote:
I'd use a VBA function:
Function GetDate(DS As String) As Date
Dim N As Long
Dim S As String
N = InStr(1, DS, " - ", vbBinaryCompare)
S = Mid(DS, N + 3)
N = InStr(1, S, " ", vbBinaryCompare)
S = Mid(S, N + 1)
S = Replace( _
Replace( _
Replace( _
Replace(S, "nd", vbNullString), _
"rd", vbNullString), _
"th", vbNullString), _
"st", vbNullString)
GetDate = DateValue(S)
End Function
Then call this from cell A2 as
=GetDate(A1)
Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Fri, 28 Nov 2008 09:35:02 -0800, Woodi2
wrote:
Flight Schedule - Friday 28th
November 2008.
Chip,
You also need to replace the "." at the end of the string, if you are going to
use this approach.
--ron
|