Make a date stamp for a filename

Turn November 4, 2026 into 20261104 for file names. Missing dates stay blank.

What you'll make

In Excel: November 4, 2026 becomes 20261104.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1OR(A8="",A8=0)Checks for an empty cell or a 0 placeholder.No
2A8The real date.November 4, 2026
3"yyyymmdd"The pattern: 4-digit year, 2-digit month, 2-digit day."yyyymmdd"
4TEXT( … )Writes the date in that pattern as text."20261104"
5IF( … )Leaves the cell blank if part 1 says yes."20261104"

Read it left to right. Without part 1, a 0 would show as a date in 1900.

=IF(OR(A8="",A8=0),"",TEXT(A8,"yyyymmdd"))

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 into the green column of the Template tab. The date stamps fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

The stamp is text, not a date. Keep your date column for date sums.

Microsoft's help: TEXT function