Excel and formulas

Excel formula for date difference

Calculate how many days pass between two dates.

Italian Excel formula

Giorni: =B2-A2
Mesi: =DATA.DIFF(A2;B2;"m")
Anni: =DATA.DIFF(A2;B2;"y")

English Excel formula

Days: =B2-A2
Months: =DATEDIF(A2,B2,"m")
Years: =DATEDIF(A2,B2,"y")
Example

A2=01/01/2026 and B2=31/01/2026: 30 days.

Common error

If you see a date instead of a number, change cell format to Number.

How it works

Excel stores dates as numbers.

DATEDIF is useful for complete months or years.

Frequently asked questions

How do I calculate days between dates?

Use =B2-A2.

Why do I see a date?

Change cell format.

Related tools