Excel formula builder

Date Difference Formula Builder

Create a date difference formula for days, months, or years using date cell references.

Builder inputs

Use cells that contain real spreadsheet dates.

Formula is valid and ready to copy.

Excel formula
=B2-A2
Google Sheets formula
=B2-A2
Explanation
Subtracting dates returns calendar days.

How this formula works

  • For days, spreadsheets can subtract the start date from the end date.
  • For completed months or years, DATEDIF returns whole elapsed periods.
  • The result depends on valid date values, not text that only looks like a date.

Sample data

Start DateEnd DateExpected Days
2026-01-012026-01-3130
2026-02-102026-03-1230
2026-04-152026-05-0116

Common mistakes

  • Text dates can break subtraction and DATEDIF.
  • DATEDIF returns completed periods, not rounded months or years.
  • If end date is before start date, the result can be negative or an error depending on the formula.

Related formulas

FAQ

Are these formulas generated with AI?

No. The builder uses deterministic TypeScript functions in the browser and does not call any AI API.

Do I need to upload my spreadsheet?

No. Enter ranges and criteria manually. The site does not upload, store, or process spreadsheet files.

Can I copy the generated formula?

Yes. Each output includes a copy button so you can paste the formula into Excel or Google Sheets.