Date Functions
Intermediate

Work out when a warranty runs out

The expiry date isn't stored anywhere — you build it from a purchase date and a length in months.

Task:

You run the returns desk at a hardware store. A customer wants to know if their drill is still under warranty, but the file only has the purchase date and how many months of cover it came with — nobody stores the expiry date itself. Work out the expiry date for each item in column D.

Learning Objectives:

  • Rebuild a date from its year, month and day with DATE
  • Add whole months to a date by feeding DATE a month argument past 12
  • Pull a date apart with YEAR, MONTH and DAY before reassembling it
Hints

Solve without hints for +5 XP

Interactive Spreadsheet

The data in this exercise

This is the grid you start with. Cell references in the task — B6, C2 — point at the row numbers and column letters below.

ABCD
1ItemPurchase DateWarranty (months)Expiry Date
2Cordless drill1/15/202612
3Table saw3/10/202624
4Impact driver6/22/20266
What this exercise teaches (contains the answer)

DATE(YEAR(B2),MONTH(B2)+C2,DAY(B2)) works because DATE's month argument isn't capped at 12 — pass it 1+12=13 and it treats that as month 1 of the following year, which is exactly the carry a warranty needs when a 12-month term crosses a year boundary. Pulling the purchase date apart with YEAR, MONTH and DAY and folding the warranty length into just the month piece before handing all three back to DATE does the month arithmetic in a single step, without ever converting to a day count and back.