Date Comparison

Copper Contributor

Hello,

I am trying two compare dates in the form 6/2/2019 (MDY) and 5/15/2018. I want it to tell me if one is more recent than the other. I am trying to compare them using the '>' and "<" operators, but it is not working.

If you have any experience and insight on this problem, please let me know.

 

Thanks.

3 Replies

@Benhill

 

Please try this formula:

=IF(AND(ISNUMBER(A2),ISNUMBER(B2)),IF(A2>B2,"Date 1 is more recent than Date 2.",IF(A2<B2,"Date 2 is more recent than Date 1.","The two dates are equal!")),"")

Comparison Between Two Dates.png 

 

Best Regards,

Haytham

@Benhill hello there. Could you be more specific about what doesn't work exactly? Since dates are essentially numbers (i.e. serial numbers), a comparator can be used without issue. The formula provided above ensures both dates entered are actually numbers and not text, which could very well be your problem. An easy way to check is to remove any horizontal alignment and widen the column; if the data is left-aligned it's seen as text, whereas if it's right-aligned it's seen as numerical (including dates). If this is the case, either coerce the textual date to be numerical, or coerce your formula dependencies. Generally it's better to do the former.

@Zack Barresse 

@Haytham Amairah 

 

 

Thank you for your replies, I got the problem figured out.