calculate the time between dates<\/a>.<\/p>\n\n\n\nDATEDIF<\/h2>\n\n\n\n When you start typing the function name, you will notice that it doesn\u2019t show up from the available options.<\/p>\n\n\n\n <\/figure>\n\n\n\nIf you go to Formulas >> Function Library >> Date & Time<\/strong> you can see that there\u2019s no such function as DATEDIF<\/strong>.<\/p>\n\n\n\n <\/figure>\n\n\n\nThere is no help from Excel there. But if you know the parameters, you can enter them and it will work.<\/p>\n\n\n\n <\/figure>\n\n\n\nIn the following example, the first and second arguments are the start and end dates. The third one is the unit. In our case, it\u2019s a day (D)<\/strong>.<\/p>\n\n\n\n=DATEDIF(B2,B3,\"D\")<\/code><\/pre>\n\n\n\nYou can also choose M<\/strong> for months<\/strong> and Y<\/strong> for years<\/strong>.<\/p>\n\n\n\nDATEDIF function examples<\/h2>\n\n\n\n This is an example with additional units, where you ignore part of a date.<\/p>\n\n\n\nStart<\/strong><\/td>End<\/strong><\/td>Difference<\/strong><\/td>Formula<\/strong><\/td>Returns<\/strong><\/td><\/tr>2014-01-01<\/td> 2022-02-25<\/td> 2977<\/td> =DATEDIF(A2,B2,”D”)<\/td> days (same as B2 – A2)<\/td><\/tr> <\/td> <\/td> 97<\/td> =DATEDIF(A2,B2,”M”)<\/td> months<\/td><\/tr> <\/td> <\/td> 8<\/td> =DATEDIF(A2,B2,”Y”)<\/td> years<\/td><\/tr> <\/td> <\/td> 24<\/td> =DATEDIF(A2,B2,”MD”)<\/td> days (ignores months and years)<\/td><\/tr> <\/td> <\/td> 1<\/td> =DATEDIF(A2,B2,”YM”)<\/td> months (ignores years)<\/td><\/tr> <\/td> <\/td> 55<\/td> =DATEDIF(A2,B2,”YD”)<\/td> days (ignores years)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\nArithmetic operators<\/h2>\n\n\n\n As I wrote at the beginning, math on dates it\u2019s more complicated than on numbers, but it doesn\u2019t mean that you can\u2019t use standard arithmetic operators to calculate the difference.<\/p>\n\n\n\n
Let\u2019s see how it looks in our example.<\/p>\n\n\n\n <\/figure>\n\n\n\nThe result is the same as with the DATEDIF<\/strong> function, but if you switch B2<\/strong> with B3<\/strong> values, you are going to have a negative number of operators and errors for the function.<\/p>\n\n\n\n <\/figure>\n","protected":false},"excerpt":{"rendered":"If you want to calculate the time between two dates, you have to remember that\u2019s a bit more complicated than calculating the difference…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[170],"yoast_head":"\n
Calculate the Amount of Time Between Two Dates in Excel<\/title>\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n