Function Problems

Calculate Expiration Dates with EDATE and Julian Codes in Excel

Natalie TaylorNatalie Taylor Dec 2, 2026 868 views

Question details

Combine Julian-style date conversion and EDATE in one formula to calculate product expiration dates.

Calculate Expiration Dates with EDATE and Julian Codes in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A product's date code is in column C and its shelf life in months is in column B.
Observed behavior
The formula should convert the date code to a calendar date and add the shelf life in months.
Before you start

Confirm that the date code uses the YYDDD format: a two-digit year followed by the day of the year. Enter the shelf life as a number of months in B5 and the date code in C5.

Solution 1Recommended

Convert the Julian-style code and add months with EDATE

Use one formula to convert a YYDDD code and calculate the expiration date, including when a leading zero is missing.

This formula treats years 00–29 as 2000–2029 and years 30–99 as 1930–1999. Change the cutoff if your date codes use a different century rule.

The code must be a valid YYDDD value, with a day number from 001 through 365, or 366 in a leap year. DATE can roll invalid day numbers into another year rather than flagging them.

1
Enter the formula

Select an empty cell such as D5 and enter =IF(C5="","",EDATE(DATE(IF(VALUE(LEFT(TEXT(C5,"00000"),2))<30,2000,1900)+VALUE(LEFT(TEXT(C5,"00000"),2)),1,VALUE(RIGHT(TEXT(C5,"00000"),3))),B5)).

2
Format the result

Select D5 and choose Home > Number Format > Short Date, or apply another date format.

3
Fill the formula down

Drag the fill handle from D5 down to calculate expiration dates for the remaining rows.

Convert the Julian-style code and add months with EDATE
Check a sample: If C5 contains 24060 and B5 contains 12, the start date is February 29, 2024, and the result is February 28, 2025.
WPS Spreadsheets

Calculate Julian-Code Expiration Dates in WPS Spreadsheets

Use the same DATE and EDATE formula in WPS Spreadsheets to convert YYDDD product codes and add shelf life in months.

  1. 1. Open your workbook: Open WPS Spreadsheets and choose Open to select your Excel workbook, or create a new spreadsheet.
  2. 2. Enter the source values: Enter the shelf life in months in B5 and the YYDDD date code in C5.
  3. 3. Calculate the expiration date: Select D5 and enter =IF(C5="","",EDATE(DATE(IF(VALUE(LEFT(TEXT(C5,"00000"),2))<30,2000,1900)+VALUE(LEFT(TEXT(C5,"00000"),2)),1,VALUE(RIGHT(TEXT(C5,"00000"),3))),B5)).
  4. 4. Format and fill: Use Home > Number Format to display D5 as a date, then drag its fill handle down for other products.
Calculate expiration dates from Julian-style codes and month-based shelf life.Open and edit Microsoft Excel XLSX and XLS files.Fill a formula down across product rows.Use familiar spreadsheet formatting tools.
microsoft office alternative - wps office

Frequently Asked Questions

What does YYDDD mean in this formula?

YY is the two-digit year and DDD is the day number within that year. For example, 24060 represents the 60th day of 2024, or February 29, 2024. This is a Julian-style ordinal date, not an astronomical Julian day number.

How does the formula handle a missing leading zero?

TEXT(C5,"00000") pads a numeric code to five digits. For example, 1025 becomes 01025, which the formula reads as the 25th day of 2001.

Why does my expiration date appear as a number?

Excel stores dates as serial numbers. Select the result cell and choose Home > Number Format > Short Date to display it as a date.

What happens if the target month has fewer days?

EDATE returns the last valid day of the target month. For example, adding 12 months to February 29, 2024, returns February 28, 2025.

How can I change the century cutoff?

Edit the <30 test and the 2000 and 1900 values in the formula's IF expression to match the century rules used by your product codes.