8/25/2023 0 Comments Excel formula to subtract datesNotice that the result in rows 5, 6, and 7 is an exact multiple of months, but the result in D8 has been rounded down.Īlso notice that results in rows 12 through 15 are a bit quirky, due to the way DATEDIF handles end of month dates. The behavior of DATEDIF is automatic. The result is an integer that represents complete whole months between the start date in column B and the end date in column C. In the example shown, the formula in D5, copied down, is: =DATEDIF(B5,C5,"m") In this case, we want months, so we supply "m" for unit. DATEDIF takes 3 arguments: start_date, end_date, and unit. In the example shown, we are calculating complete whole months between a start date and an end date with the DATEDIF function. See this page on the DATEDIF function for more information about available arguments. The solution described below uses the DATEDIF function. DATEDIF is a "compatibility" function that comes originally from Lotus 1-2-3. You can use DATEDIF in all current Excel versions, but you must enter the function manually – DATEDIF will not appear as a suggested function in the formula bar and Excel will not help you with function arguments. This is a slightly tricky problem in Excel because the number of days in any given month varies, so the rules about how a whole month might be calculated are not obvious. In this example, the goal is to calculate whole months between two valid Excel dates.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |