Forum Discussion
Sheltdr8
Jan 25, 2022Copper Contributor
Compare dates not working correctly
I am trying to compare two date sets and if the Age column is greater than the $X$2 (Age Max) column than place an X in an X Value cell. It almost works but if the month is 10, 11, or 12 it only look...
HansVogelaar
Jan 25, 2022MVP
- Sheltdr8Jan 26, 2022Copper Contributor
Thank you but still did not solve the issue, when it reaches the month it still treats 2-9 as greater than 10-12. I suspect it is only viewing the first digit.
- HansVogelaarJan 26, 2022MVP
You should use the dates in the formula, not the text values formatted as "m years n months".
- JMB17Jan 26, 2022Bronze ContributorYou could try formatting your years and months to include leading zeros using the text function. So, it's comparing "06" to "10" and now "1" is > "0".
=TEXT(DATEDIF(D16,$U$2,"Y"), "000")&" Years, "&TEXT(DATEDIF(D16,$U$2,"YM"), "00")&" Months"
=TEXT(DATEDIF(W2,$U$2,"Y"), "000")&" Years, "&TEXT(DATEDIF(W2,$U$2,"YM"), "00")&" Months"