Search code examples
excelfunctiondatecomparisonformula

How to compare two dates in two cells in Excel?


How do I compare two dates (if they're the same date) in two different cells in Excel?

e.g.:
Cell A1: 11/12/2018
Cell A2: 11/12/2018

If they match return "YES", otherwise "No".

=IF(NUMBERVALUE(A1)=NUMBERVALUE(A2),"YES","NO")

I tried the above but to no avail.


Solution

  • My guess is that the two dates have a time componant to them.

    Try:

    =IF(INT(A1)=INT(A2),"Yes","No")