Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Unique Military Date Format.

Unique Military Date Format

Written by Allen Wyatt (last updated August 3, 2019)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


For some purposes, the military uses a variation of what is called a "Julian date" to record a specific date. This special date format consists of the year digits (with no leading zeros) followed by the absolute day of the year. Thus, 9 July 2019 would end up as 19190. This shows the year (19, which is for 2019) followed by the 190th day of the year (July 9).

The military is not alone in its use of such dates. Some other industries also rely on this type of date format. Excel, however, doesn't rely on this type of format. Instead, it uses more common formatting for the display of dates, and its own serial number format for the internal storage of dates. If you need to work with the Julian dates (perhaps you are in the military), you may wonder if there is a way to format dates in this manner.

The short answer is that there is no native way to do it. The custom formatting capabilities of Excel don't allow you to indicate a way to display the day of the year. So, this means that you must use a formula to return either a numeric value for the Julian date, or a text string that contains the Julian date.

If you want to return a text string containing the formatted date, then you can use a formula such as the following:

=RIGHT(YEAR(A1),2)&(A1-DATE(YEAR(A1),1,1)+1)

This formula assumes that cell A1 contains a regular Excel date. The first part of the formula (the part before the ampersand) returns the last digit of the year and the part after the ampersand subtracts the first day of the current year from the date being converted, and then adds 1 back to that date. The result is the ordinal day within the year.

If the day-of-the-year portion of the Julian date must always be three digits, then you need to modify the formula just a bit more. As written above, the formula will return 1, 2, or 3 digits for the last part of the formula. If it always needs to be 3, then use this, instead:

=RIGHT(YEAR(A1),2)&RIGHT("000"&(A1-DATE(YEAR(A1),1,1)+1),3)

If you prefer to have the formula return a number rather than a text string, you could enclose the entire formula within a VALUE function, or you could simply multiply the year digit by 1000 in the formula. Both approaches are shown here:

=VALUE(RIGHT(YEAR(A1),2)&RIGHT("000"&(A1-DATE(YEAR(A1),1,1)+1),3))
=RIGHT(YEAR(A1),1)*1000+(A1-DATE(YEAR(A1),1,1)+1)

You can also find information on working with Julian dates in Microsoft Office Support:

https://support.office.com/en-us/article/Insert-Julian-dates-Functions-0c7fa6aa-daff-402e-9990-93a5b76ba018

There is also additional information available on Chip Pearson's Web site:

http://www.cpearson.com/excel/jdates.htm

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9150) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Unique Military Date Format.

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. ...

MORE FROM ALLEN

Printing Hidden Text

One of the formatting attributes you can add to text is to make it "hidden," which means you can control whether it is ...

Discover More

Moving from Sheet to Sheet with the Keyboard

Hate to take your fingers off the keyboard? Here's how you can move from worksheet to worksheet without touching the mouse.

Discover More

Handling Negative Numbers in a Complex Custom Format

Custom formats are great for defining how a specific value in a cell should look. They aren't that great at doing complex ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Returning Nothing If Two Values are Empty

Excel includes a large number of functions that can be used in evaluating the data in a worksheet. In this tip you learn ...

Discover More

Determining Month Names for a Range of Dates

Given a starting date and an ending date, you may want to generate the names of all the months between those two dates. ...

Discover More

Converting European Dates to US Dates

Those in Europe use a date format that is different than those in the US; this is not news. But what if you need to ...

Discover More
Subscribe

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

View most recent newsletter.

Comments

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 two less than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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
Subscribe

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.