ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can you strip the time of day out of a date field (https://www.excelbanter.com/excel-discussion-misc-queries/83996-how-can-you-strip-time-day-out-date-field.html)

Ron

How can you strip the time of day out of a date field
 
I'm trying to sort by the time of day. Because the date and time field are
part of the same number the worksheet sorts by date then time.
Any suggestions ?

Gary''s Student

How can you strip the time of day out of a date field
 
if the date-time is in A1, then:
=MOD(A1,1) will return the time part
--
Gary's Student


"Ron" wrote:

I'm trying to sort by the time of day. Because the date and time field are
part of the same number the worksheet sorts by date then time.
Any suggestions ?


Niek Otten

How can you strip the time of day out of a date field
 
=MOD(A1,1), fill down as far as needed.
Select the column, Copy, Paste Special, check Values.
Now you can sort on that column

--
Kind regards,

Niek Otten

"Ron" wrote in message ...
| I'm trying to sort by the time of day. Because the date and time field are
| part of the same number the worksheet sorts by date then time.
| Any suggestions ?



Dave Peterson

How can you strip the time of day out of a date field
 
If you really have date and time in a cell (say A1):

=a1-int(a1)
or
=mod(a1,1)

(Format as time)


Ron wrote:

I'm trying to sort by the time of day. Because the date and time field are
part of the same number the worksheet sorts by date then time.
Any suggestions ?


--

Dave Peterson


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com