#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
IT05
 
Posts: n/a
Default format date time

5/12/2005 1:20:33 PM = text field
10/20/2004 10:02:40 AM = text field

I need to extract just the date and ignore the time.

Tried =MID(F2,1,9) and it worked for 5/12/2005 1:20:33 PM. Output showed
5/12/2005

Apparently this would not work for 10/20/2004 10:02:40 AM. Output would show
10/20/200.

Is there a work-around for this or a different formula that can be used?


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David McRitchie
 
Posts: n/a
Default format date time

Hi IT05, (certainly hope that's not your real name),

Dates are stored as days past a base date, and time is fractional days both
can be in the same cell as a number.

If format is all you want then format as mm/dd/yyyy but if
you need the value then you can use =MOD(A1,1) which
will remove decimal places and format as mm/dd/yyyy
dates are numbers so you can change the format without reentering
because you are not switching between text and numbers (or numbers and text)..

More information on Date and Time
http://www.mvps.org/dmcritchie/excel/datetime.htm
http://www.cpearson.com/excel/datetime.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"IT05" wrote in message ...
5/12/2005 1:20:33 PM = text field
10/20/2004 10:02:40 AM = text field

I need to extract just the date and ignore the time.

Tried =MID(F2,1,9) and it worked for 5/12/2005 1:20:33 PM. Output showed
5/12/2005

Apparently this would not work for 10/20/2004 10:02:40 AM. Output would show
10/20/200.

Is there a work-around for this or a different formula that can be used?




  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default format date time


Try

=DATEVALUE(F2)

format as date


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=513373

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
daddylonglegs
 
Posts: n/a
Default format date time


If you want to keep the result as text

=LEFT(A1,FIND(" ",A1)-1)

or

=TEXT(DATEVALUE(A1),"m/d/yyyy")


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=513373

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default format date time

One mo

=INT(--A1)

And format as a date.

The -- converts the text to numbers and the int() drops the fractional portion
(the time).

IT05 wrote:

5/12/2005 1:20:33 PM = text field
10/20/2004 10:02:40 AM = text field

I need to extract just the date and ignore the time.

Tried =MID(F2,1,9) and it worked for 5/12/2005 1:20:33 PM. Output showed
5/12/2005

Apparently this would not work for 10/20/2004 10:02:40 AM. Output would show
10/20/200.

Is there a work-around for this or a different formula that can be used?


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
David McRitchie
 
Posts: n/a
Default format date time

Oops serious problem with my reply as MOD(A1,1) would retain only
the time not the date. Dave Peterson 's integer response would be


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I calculate if a date is in a certain time frame? Pe66les Excel Worksheet Functions 19 August 27th 05 11:07 PM
imported impromtu report date issue - fix by format or formula Todd F. Excel Discussion (Misc queries) 3 July 7th 05 09:57 PM
DOS Data in Excel Format with Date and Military Time in same cell Jules Excel Worksheet Functions 1 March 14th 05 09:31 PM
Subtracting time in date format Collcat Excel Worksheet Functions 0 November 11th 04 04:44 PM
Subtracting time in date format Collcat Excel Worksheet Functions 1 November 10th 04 04:45 PM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"