Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Unique Military Date Format.
Written by Allen Wyatt (last updated September 4, 2021)
This tip applies to Excel 97, 2000, 2002, and 2003
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 followed by the absolute day of the year. Thus, 9 July 2013 would end up as 13190. This shows the year (13, which is for 2013) 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's Knowledge Base:
http://support.microsoft.com/kb/214099
This article indicates it is for Excel 2000, but the formulas it presents work well in other versions of Excel as well. 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 (3227) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Unique Military Date Format.
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!
Excel can easily store dates. If you want to increment a date by one month, there are a number of ways you can accomplish ...
Discover MoreHow do you display a number of years, such as 3.67 years, as a number of years and months? It's simple to do with a ...
Discover MoreMany businesses need to know when the last business day of the month occurs. This tip discusses several ways you can ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments