Export a date as a yyyyddd code

Turn November 4, 2026 into the text 2026308: the year, then the day of the year.

What you'll make

In Excel: November 4, 2026 becomes 2026308.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1TEXT(YEAR(A8),"0000")Writes the year as four digits."2026"
2A8-DATE(YEAR(A8),1,0)Counts the day number in the year.308
3,"000"Asks for three digits, with zeros in front.Not used yet
4TEXT( … )Writes the day as three digits after the year."2026308"

Part 4 works on parts 2 and 3 inside it. January 15 becomes 015, so every code has seven digits.

=TEXT(YEAR(A8),"0000")&TEXT(A8-DATE(YEAR(A8),1,0),"000")

How to use it

Yellow bar at the top? Click Enable Editing.

  1. See it work. The Example tab shows 20 made-up examples with the formula already in.
  2. Use your own dates. Paste real dates with no time into the green column of the Template tab. The codes fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Only use this code where the system you send to asks for yyyyddd. People won't read it as a date.

Microsoft's help: TEXT function