ExcelTip.com
ExcelTip.com
Account Icon Account Icon Account Icon
Google Exceltip.com
JOIN OUR NEWSLETTER
  and receive for joining:
Free eBook Learn More!
Free Excel ADD-IN
Free Weekly Excel Tip
4 e-books in cd-rom
F1 Formulas & Functions
F1 Formulas & Functions
F1 EXCEL
F1 eBook (Spanish)
F1 EXCEL
Financial Statements.xls
 

» Converting a Julian Date to a Calendar Date


Problem:

Listed in column A are Julian dates in "YYJJJ" format.
"YY" represents a year between 1920 and 2020, and "JJJ" represents the serial number of the day within the year.
We want to convert each date in column A to its corresponding calendar date.

Solution:

Use the LEFT, IF, and MOD functions as shown in the following formula and format the results as dates:
=("1/1/"&(IF(LEFT(A2,2)*1<20,2000,1900)+LEFT(A2,2)))+MOD(A2,1000)-1
Rate this tip
12 34 5
  RATING: 2.90
  VIEWS: 27505

READER COMMENTS (view all comments)


Inserting calendar in VBA form to have date inputs
dwijraj wrote on December 01, 2005 13:15 EST
Hi,
I want to include the calendar in my VBA form to take date inputs from the calendar.
I do not know exactly how that can be done.

Thanks
Dwij
Revised formula to handle Julian dates with leading zeros
Paul Laba wrote on January 10, 2006 09:49 EST
This conversion formula works great, but will not work correctly if the Julian date cell is numeric and the date's year field contains a leading zero (e.g., "03365"). In that case Excel will strip the leading zero, and the conversion formula will produce an erroneous result.

To illustrate, enter the Julian date value 03365 in cell A2 (formatted as General, Number, Currency, etc.). The value displayed in cell A2 will be 3365 (no leading zero). The converted date in cell B2 will be 12/31/1933 instead of 12/31/2003.

One way to deal with this leading zeros problem is to ensure the cell containing the Julian date is formatted as Text; Excel will treat any entries in the cell "as is" and not strip any leading zeros.

You can also work around this leading zero problem by entering the Julian date with a leading apostrophe ('03365); Excel will then treat your entry as text, even though the cell itself might not be formatted as Text.

Best would be to use a conversion formula that correctly handles Julian date values that contain only a single digit year. Here one formula that does that:

=("1/1/"&(IF(LEFT(A2,LEN(A2)-3)*1<20,2000,1900)+LEFT(A2,LEN(A2)-3)))+MOD(A2,1000)-1

Here's another:

=("1/1/"&(IF(INT(A2/1000)<20,2000,1900)+INT(A2/1000)))+MOD(A2,1000)-1

The second formula is preferred, as it treats the Julian date value as a number and makes no assumption about the "length" of the value.

The second formula will even convert Julian dates with *no* year field (the Julian date value '365' is converted to 12/31/2000).

Paul
Doesn't work well with 2000 + dates
Dcdrj2 wrote on January 12, 2006 16:09 EST
With dates > 2000 example 05339 the date redutured is 12/05/53 when it should be 12/05/05:rolleyes:

[QUOTE=ExcelTip]Problem:

Listed in column A are Julian dates in "YYJJJ" format.
"YY" represents a year between 1920 and 2020, and "JJJ" represents the serial number of the day within the year.
We want to convert each date in column A to its corresponding calendar date.

Solution:

Use the LEFT, IF, and MOD functions as shown in the following formula and format the results as dates:
=("1/1/"&(IF(LEFT(A2,2)*1[/QUOTE]
converting Julian date to calendar date
tpham wrote on June 07, 2006 17:20 EST
problem:

I have colunm A : 2005 145 23:25

I want to convert it to calenader date like:
5/25/2005 23:25

but i don't know how to do , please help

Big thanks

TP
Converting a Julian Date to a Calendar Date
tammy wrote on December 31, 1969 18:00 EST
problem
colunm A: 2005 145 22:25

I want to convert to calendar date such:
05/25/2005 22:25

I don't know how to convert it to corresponding calendar date. please help me

Big thanks
tp



REGISTERED USERS - Click here to post comments


GUESTS (Click here to register)
Name
Comment Title
Comments

Investing for Dummies, Third Edition

The Laws of Money, The Lessons of Life: Keep What You Have and Create What You Deserve

Microsoft Excel 2002 Formulas (With CD-ROM)

Windows XP for Dummies

A Mathematician Plays the Stock Market

The Intelligent Investor: The Classic Bestseller on Value Investing

RELATED MICROSOFT EXCEL TIPS


Convert PDF Files to Excel


Excel VBA books
Accounting books
Business Plans
MS Office books
Taxes books

VIEW ALL BOOKS


  Advertise With Us                               

Tips

Add-In in VBA | Applications - Word, Outlook in VBA | Array Formulas | Cells, Ranges, Rows, and Columns in VBA | Counting | Custom Functions | Custom Functions in VBA | Database Formulas | Database in VBA | Date & Time Formulas | Date & Time in VBA | Events in VBA | Excel 2003 | Excel Chart | Excel Consolidating | Excel Counting | Excel Custom Functions using VBA | Excel Customizing | Excel Data | Excel Dates | Excel Editing | Excel Files | Excel Filter | Excel Format | Excel Formula | Excel General | Excel Grouping and Outlining | Excel Importing Text Files | Excel Information | Excel Keyboard Shortcuts | Excel Loan Formulas | Excel Macros - VBA | Excel Pivot Tables | Excel Printing | Excel Range Name | Excel Security - Protection | Excel Sorting | Excel Style | Excel Subtotals | Excel Summing | Excel Text | Excel Time | Excel Tools | Excel Worksheet, Workbook | Files, Workbook, and Worksheets in VBA | Financial Formulas | Formating in VBA | General Topics in VBA | Import and Export in VBA | Information Formulas | Keyboard & Other Shortcuts in VBA | Keyboard Formula Shortcuts | Links between Worksheet and Workbooks | Links in VBA | Logical Formulas | Lookup Formulas | Mail - Send and Receive in VBA | Menus, Toolbars, Status bar in VBA | Modules, Class Modules in VBA | Other Q&A Formulas | Printing in VBA | Protecting in VBA | Summing | Text Formulas | User Forms, Input boxes in VBA | Using Loops | Working with Formulas |

Tips by Version

Microsoft Excel 97 | Microsoft Excel 2000 | Microsoft Excel 2002 | All Microsoft Excel Versions | New in Excel 2002 | New in Excel 2003 - Office 11

Website

Home | Tip of Hour | Recommended Tips | Most Viewed Tips | Tips by Version | Submit a Tip | My Tips
Microsoft Excel Tutorials | Excel Links | Write for Us | About Us | Search Results | Tip Archives | Excel Forum | Excel Forum Archives

Excel Book

Excel 97 Book | Excel 2000 Book | Excel 2002 Book | Excel XP Book | Book Store

Terms and Conditions of use
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Copyright © 2003 ExcelTip.com
Microsoft, Microsoft Excel is a U.S. registered trademark of Microsoft Corporation
Site Developed By: Varien