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.
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)
| Parameter | Meaning | Example |
|---|---|---|
start_date | The starting/earlier date | Birth date or Start date (A2) |
end_date | The ending/later date | Today date or End date (B2) |
unit | Code for result type ("Y", "M", "D", etc.) | "Y" for years, "M" for months |
Unit Codes Table:
| Unit Code | Output 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:
44months.
- Result:
-
Total Days:
=DATEDIF(A2, B2, "D")- Result:
1351days.
- Result:
📺 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:
DATEDIFis 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_datemust ALWAYS be earlier thanend_date. If start date is after end date, Excel gives error.- Calculate Age Live: Use
=TODAY()asend_date(e.g.=DATEDIF(A2, TODAY(), "Y")) so age updates automatically every year!
📚 Related Resources
Related Tutorials
Opens in new tab ↗How to Calculate Working Days in Excel with Cambodia Public Holidays (Khmer Video)
Learn how to calculate net working days between two dates in Excel excluding weekends and Cambodia Public Holidays using NETWORKDAYS and NETWORKDAYS.INTL formulas.
INT vs MOD Function in Excel: What is the Difference? (Easy Guide)
Learn the difference between INT and MOD functions in Excel. Very simple examples to help you understand whole numbers and remainders.
How to Use RATE Function in Excel (Find Hidden Interest)
Learn how to use RATE function in Excel to find out the real interest rate the bank is charging you. Very simple and easy!