How to Use DATEDIF Function in Excel (Khmer)

Learn how to use DATEDIF function in Excel step-by-step to calculate number of days, months, or years between two dates.

Advertisement
Formula
=DATEDIF(start_date, end_date, unit)

Hello everyone! Today I show you very easy step-by-step how to use DATEDIF() function in Microsoft Excel with video guide in Khmer language.

The DATEDIF function helps you calculate the exact number of days, months, or years between two dates. It is super useful for calculating employee age, work experience, project duration, or contract tenure!

🛠️ How DATEDIF Function Works

Formula Syntax:

=DATEDIF(start_date, end_date, unit)
ParameterMeaningExample
start_dateThe starting/earlier dateBirth date or Start date (A2)
end_dateThe ending/later dateToday date or End date (B2)
unitCode for result type ("Y", "M", "D", etc.)"Y" for years, "M" for months

Unit Codes Table:

Unit CodeOutput Result
"Y"Total complete Years between dates
"M"Total complete Months between dates
"D"Total complete Days between dates
"YM"Difference in Months (ignores years)
"MD"Difference in Days (ignores months and years)
"YD"Difference in Days (ignores years)

📺 Example 1: Calculate Age in Complete Years ("Y")

If employee birth date is in cell A2 (15/05/1995):

=DATEDIF(A2, TODAY(), "Y")
  • Result: 31 (complete years old today!)

📺 Example 2: Calculate Total Working Experience in Months & Days

If start work date is A2 (01/01/2023) and end date is B2 (13/09/2026):

  • Total Months:

    =DATEDIF(A2, B2, "M")
    
    • Result: 44 months.
  • Total Days:

    =DATEDIF(A2, B2, "D")
    
    • Result: 1351 days.
Advertisement

📺 Example 3: Combined Formula (Years + Months + Days)

To show full age or service tenure like 31 Years, 3 Months, 29 Days:

=DATEDIF(A2, B2, "Y") & " Years, " & DATEDIF(A2, B2, "YM") & " Months, " & DATEDIF(A2, B2, "MD") & " Days"

📹 Watch Khmer Video Tutorial

Watch video step by step below to see how to use DATEDIF function in Excel:

💡 Quick Tip:

  • Excel Hidden Secret Function: DATEDIF is a legacy compatibility function. Excel does NOT show it in formula auto-complete list when you type, but it works 100% perfectly! Just type =DATEDIF( manually.
  • #NUM! Error Fix: If formula returns #NUM! error, check your dates! start_date must ALWAYS be earlier than end_date. If start date is after end date, Excel gives error.
  • Calculate Age Live: Use =TODAY() as end_date (e.g. =DATEDIF(A2, TODAY(), "Y")) so age updates automatically every year!

📚 Related Resources

Found this tutorial helpful? Share it with colleagues:
📚

Related Tutorials

Opens in new tab ↗
Advertisement