How to calculate the difference between two dates for only one time?

happydz

New Member
Joined
Jan 11, 2017
Messages
41
How to calculate the difference between two dates so that the result comes up as just as only number of days less than 7 days or weeks less than 4 weeks or months less than 12 months or just number of years. To make it clear, I have this example (1):
Let's assume that the old date is 25/05/2022 and the recent date is 28/05/2022 so the result will be 0 years, 0 months, 3 days. but I want the result to show only 3 days instead of displaying the 0 years, 0 months.
Example (2): old date is 07/05/2022 - recent date is 28/05/2022. the result will be 0 years, 0 months, 3 weeks. but I want the result to show only 3 weeks instead of displaying the 0 years, 0 months.
Example (3): old date is 19/4/2022 - recent date is 28/05/2022. the result will be 0 years, 0 months, 5 weeks, 4 days. but I want the result to show only 1 month instead of displaying the 0 years, 5 weeks, 4 days.
Example (4): old date is 10/05/2021 - recent date is 28/05/2022. the result will be 1 years, 1 months, 0 weeks, 9 days. but I want the result to show only 1 year instead of displaying 1 years, 1 months, 0 weeks, 9 days

I need a formula to use in column C as date difference if the column A is relating to the old date and B is relating to the recent column.

I hope these examples make it clear for you to help me.

Social Media Accounts.xlsx
ABCDE
15/25/20225/28/2022
25/7/20225/28/2022
34/14/20225/28/2022
45/10/20215/28/2022
Feuil7
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Book1
ABC
125/05/202228/05/20223 days
207/05/202228/05/20223 weeks
319/04/202228/05/20221 month
410/05/202128/05/20221 year
Sheet1
Cell Formulas
RangeFormula
C1:C4C1=IF(DATEDIF($A1,$B1,"y")>0,DATEDIF($A1,$B1,"y") & " year" & IF(DATEDIF($A1,$B1,"y")>1,"s",""),IF(DATEDIF($A1,$B1,"m")>0,DATEDIF($A1,$B1,"m")&" month"&IF(DATEDIF($A1,$B1,"m")>1,"s",""),IF(DATEDIF($A1,$B1,"d")>6,INT(DATEDIF($A1,$B1,"d")/7)&" week" & IF(DATEDIF($A1,$B1,"d")>13,"s",""), DATEDIF($A1,$B1,"d") & " day" & IF(DATEDIF($A1,$B1,"d")>1,"s",""))))
 
Upvote 0
Solution
Book1
ABC
125/05/202228/05/20223 days
207/05/202228/05/20223 weeks
319/04/202228/05/20221 month
410/05/202128/05/20221 year
Sheet1
Cell Formulas
RangeFormula
C1:C4C1=IF(DATEDIF($A1,$B1,"y")>0,DATEDIF($A1,$B1,"y") & " year" & IF(DATEDIF($A1,$B1,"y")>1,"s",""),IF(DATEDIF($A1,$B1,"m")>0,DATEDIF($A1,$B1,"m")&" month"&IF(DATEDIF($A1,$B1,"m")>1,"s",""),IF(DATEDIF($A1,$B1,"d")>6,INT(DATEDIF($A1,$B1,"d")/7)&" week" & IF(DATEDIF($A1,$B1,"d")>13,"s",""), DATEDIF($A1,$B1,"d") & " day" & IF(DATEDIF($A1,$B1,"d")>1,"s",""))))
thank you for the formula, but the thing is that I have French excel and all the computers in my country are French systematic , so I'd be grateful if you can give me or rather transform the formula to work with French excel.
 
Upvote 0
thank you for the formula, but the thing is that I have French excel and all the computers in my country are French systematic , so I'd be grateful if you can give me or rather transform the formula to work with French excel.
=SI(DATEDIF($A1;$B1;"y")>0;DATEDIF($A1;$B1;"y") & " year" & SI(DATEDIF($A1;$B1;"y")>1;"s";"");SI(DATEDIF($A1;$B1;"m")>0;DATEDIF($A1;$B1;"m")&" month"&SI(DATEDIF($A1;$B1;"m")>1;"s";"");SI(DATEDIF($A1;$B1;"d")>6; ENT (DATEDIF($A1;$B1;"d")/7)&" week" & SI(DATEDIF($A1;$B1;"d")>13;"s";""); DATEDIF($A1;$B1;"d") & " day" & SI(DATEDIF($A1;$B1;"d")>1;"s";""))))
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top