If matching number, give me the years and months difference between dates

Newbie73

Board Regular
Joined
Feb 4, 2024
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hello everyone, my goal is a formula if S2 (and following values in S) matches any value in column B, then give me the difference in years and months from T2 and matching cell from column L belong to the matching value in B

Test spreadhseet in the link:


Did the first one in R2 manually as for example and any more question do let me know, don't think it's too hard but struggling to make it work.

Thanks!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
But for values in col. B are couple different dates assigned in col. L? What then...
I get max date assign into particular ID:

Test11.xlsx
BCDEFG
1IDDateIDDate
2111118/12/20235 years, 8 months111109/04/2018
3111118/10/202310 years, 4 months222215/06/2012
4111118/12/202310 years, 3 months333318/09/2013
5111118/10/20239 years, 11 months444411/01/2014
6222219/10/2022
Sheet1
Cell Formulas
RangeFormula
E2:E5E2=LET(xMonths,DATEDIF(G2,MAXIFS(C:C,B:B,F2),"m"),xYears,DATEDIF(G2,MAXIFS(C:C,B:B,F2),"y"),xYears&" years, "&xMonths-(xYears*12)&" months")
 
Last edited:
Upvote 0
But for values in col. B are couple different dates assigned in col. L? What then...
I get max date assign into particular ID:

Test11.xlsx
BCDEFG
1IDDateIDDate
2111118/12/20235 years, 8 months111109/04/2018
3111118/10/202310 years, 4 months222215/06/2012
4111118/12/202310 years, 3 months333318/09/2013
5111118/10/20239 years, 11 months444411/01/2014
6222219/10/2022
Sheet1
Cell Formulas
RangeFormula
E2:E5E2=LET(xMonths,DATEDIF(G2,MAXIFS(C:C,B:B,F2),"m"),xYears,DATEDIF(G2,MAXIFS(C:C,B:B,F2),"y"),xYears&" years, "&xMonths-(xYears*12)&" months")
Hello KOKOSEK and thank you for your time. Think you might be onto to something but not quite there. I will give some more background information, the B column values are all from the same unique ID that have procedures in different dates. The idea is to get years and months since they've joined (column G in your formula) in all the different procedures. So say in the example I've done 1111 which joined on the 09/04/2018 is 5y and 8 months on the procedure dated 18/12/2023. I would be 5y and 6 months for the previous procedure on the 18/10/2023

So each value on S only has one unique date of joining (column T) but have different or equal procedures dates. Do let me know if I didn't explained correctly.
 
Upvote 0
Anyone please? Do let me know if anyone needs any more information or if I didn't explained it well enough.

🙏
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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