Using a Text Function with a Date/Time Returns an Error

by Allen Wyatt
(last updated April 30, 2022)


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:


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:

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:

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:


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:


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, and Excel in Office 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Saving an Envelope for Future Use

It can take a while to get an envelope to appear just the way you need. Why throw your work away when you are done with ...

Discover More

AutoFormatting a Document

The AutoFormat feature of Word can be configured to make changes to a variety of conditions in your document. Here's how ...

Discover More

Using a Portion of a Document's Filename in a Header

Headers and footers add a nice finishing touch to a document you plan on printing. You may want all sorts of information ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Using Early Dates

Excel is brilliant at handling dates--as long as they aren't dates earlier than the base date used by the program. If you ...

Discover More

Calculating Differences in Months using Non-Standard Date Values

Dates can be entered into a worksheet in any number of unique or novel ways. Working with those dates can be a challenge, ...

Discover More

Determining If a Year is a Leap Year

Need to figure out if a given year is a leap year? It's not as easy as you think! This tip provides a plethora of ways ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 5?

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.

This Site

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.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.