How to remove time from date in Excel?
Sometimes, when you import data into Excel, if there has a column of date with time stamp, such as 2012/6/27 12:23, and you don’t want to retain the time stamp and want to remove it from the time (12:23) from the date. How could you quickly remove time from date in mulitple cells in Excel?
1. Select the date range that you want to remove the time.
2. Click Home > Find & Select > Replace, and a Find and Replace dialog box will pop out. See screeenshot:
3. Then enter a spacebar and a asterisk * into the Find what box. And leave blank in the Replace with box.
4. Click Replace All. And all of the time stamp have been removed in the date range. See screenshot:
5. Then you can format the range to show only the date.
With the function of Text to Columns, you can also remove time from the date. Please do as the following steps:
1. Highlight the range you need to delete the time stamps.
2. Click Data > Text to Columns, and a Convert Text to Columns Wizard will appear. See screenshot:
3. Check Delimited, and click Next. Then check Space, and go on next.
4. At last, click Finish. And the time have been isolated from the date. See screenshot:
5. Then you can delete column D. And remember to format the date as you like.
The following VBA code can help you quickly to remove the time stamps from the date directly. Do as follows:
1. Select the range that you want to remove the time.
2. Click Developer>Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert>Module, and input the following code into the Module:
Dim oCell As Range
For Each oCell In Selection
oCell = Int(oCell)
Selection.NumberFormat = "mm/dd/yyyy"
3. Then click button to run the code. All of the time have been deleted and the date format also have been set.