Machine-translated by Google. Questions are authored in English.
Top

Discussion

In MS Excel, what does the DATEDIF function calculate?

  • A.The difference between two dates in years, months or days
  • B.The date a given number of days ahead
  • C.Whether a value is a valid date
  • D.The day of the week for a date

Answer: A

Correct answer: The difference between two dates in years, months or days

DATEDIF returns the difference between two dates in the unit given by its third argument: "Y" for complete years, "M" for complete months, "D" for days, and the compound codes "YM", "YD" and "MD" for remainders. Its standard use is age: =DATEDIF(A1,TODAY(),"Y") gives completed years, which is what an age must be - simple subtraction and division by 365 goes wrong across leap years. It is a curiosity of Excel: inherited from Lotus 1-2-3, undocumented in the function list and absent from IntelliSense, but present in every version and fully supported. It must be typed in full. The other date functions are better documented. TODAY and NOW give the current date and time; DATE builds one from parts; EOMONTH finds the end of a month; WEEKDAY gives the day number; and NETWORKDAYS counts working days between two dates, excluding weekends and a supplied holiday list.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.