Friday, September 18, 2020

Minus 2 dates and calculate the difference in years/Months/Days separately

 If you are working in Excel and trying to write a formula to subtract 2 dates and if you need output in number of Years/Months/Days then use below formula. 

=INT((TODAY()-D3)/365.25) & " years , " & INT(MOD((TODAY()-D3)/365.25|1)*12) & " months and " & INT(MOD((TODAY()-D3)/30.4375|1)*30.4375) & " days"

It will give output like below format :

4 Years, 5 months and 12 days

You can change alias or comma as per your choice

No comments:

Post a Comment

web stats