Written by Allen Wyatt (last updated April 30, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365
Tom has a date and time in a cell, such as 4/3/2022 9:50. I wants to extract just the date, and tried using a formula to do it: =LEFT(J2,FIND(" ",J2)). However, this returned a #VALUE! error, and Tom doesn't understand why.
The simplest explanation is that the LEFT function (which Tom uses in his formula) operates on string values, and a date/time is not a string value. Rather than deal with cell J2 (as Tom is), let's say you enter into cell A1 the date/time that he notes: 4/3/2022 9:50. If you then select cell A1, you'll see the following in the Formula bar:
4/3/2022 9:50:00 AM
There is a good chance that this will differ slightly from what is actually shown in cell A1, which tells you that what is in the cell is different than what Excel is showing. In fact, if you change the formatting of cell A1 to General, you'll see that what is shown in the cell (and Formula bar) is different:
44654.40972
In other words, the date/time value is nothing but a numeric value. This value is typically referred to as a serial number or a date/time serial number. You can find out more about serial numbers and how Excel stores dates and times in this ExcelTip:
https://tips.net/T11337
Since dates and times are stored, in Excel, as numeric values, they cannot be used with a string function such as LEFT. When you try, you get an error such as what Tom saw. The solution is to either (1) change the format of cell A1 or (2) use a formula to convert the date to the textual format you want.
To change the format of the cell, just select it and use the Number Format drop-down list (on the Home tab of the ribbon) to choose a format such as Short Date or Long Date. What is displayed by these formats depends on your regional settings in Windows, but it may very well give you just what you want. If you need a more specific date format, then you can create a custom format to get exactly what you want. You can find numerous tips about how to use custom formats in this ExcelTips category page:
https://excelribbon.tips.net/C0752_Custom_Formats.html
The cell formatting approach leaves the underlying date/time serial number unchanged. If you want to change the underlying serial number so that it only contains the date, then you simply need to strip off everything after the decimal point:
=INT(A1)
You would still need to format the result as a date to view it as you want. If you don't want to worry about formatting, then you need to consider the second approach—using a formula to convert to a textual format. This formula will do exactly what Tom wants, returning just the year of the value in cell A1:
=TEXT(A1,"m/d/yyyy")
The result of using this with Tom's original date is "4/3/2022", as a textual string.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12871) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
There are calendar days and then there are business days. Excel provides two functions (NETWORKDAYS and NETWORKDAYS.INTL) ...
Discover MoreMany businesses organize information according to calendar quarters, especially when it comes to fiscal information. ...
Discover MoreExcel is great when it comes to working with dates and times. You can even do math on dates. One such easy manipulation ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-05-01 04:09:09
I run into similar problems more or less daily in my work. Normally I use an european version of this formula. It works fine.
=MONTH(J2)&"/"&DAY(J2)&"/"&YEAR(J2)
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments