Date expression

schneitodd

New Member
Joined
Mar 18, 2003
Messages
36
Office Version
  1. 2016
Platform
  1. Windows
I am looking for an expression that can be used to pull out the date from a date & time cell.
For example, I have a column of cells with the format of "12/31/02 13:00". I would like to sort data by date (12/31/02).

Initially I tried using =left(...,10) but for dates like 9/1/02 it doesn't work as well.

Any ideas...
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
If your date/time field were named MyDate, try this:

NewDate: Format([MyDate],"mm/dd/yy")

Then you can sort the query on this new calculated field.
 
Upvote 0
While trying a number of things in the interim,
I used the DATEVALUE expression. The result appeared to give me "mm/dd/yy" from the "mm/dd/yy hh:mm" format.

Is this a bad choice?
 
Upvote 0

Forum statistics

Threads
1,221,573
Messages
6,160,591
Members
451,657
Latest member
Ang24

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