The following Excel formula should get you what you are looking for:
=IF(A1=B1, "YES", "NO - " & TEXT(MIN(A1,B1), "m/d/yyyy"))
This formula says:
if the values in A1 and B1 are equal, print YES in the current cell, otherwise print 'NO - ' appended with the lowest value of the 2 cells 'textualized' as a date in the format of 'm/d/yyyy'
MIN function would return the lower of the 2 values (or dates in your case) as a serialized date (i.e. a normal number). To display it as date value, we can use the
TEXT function to print the serial number as a date in the format we specify ("m/d/yyyy" in this case).
| | A | B | C |
|1| 1/1/1970 | 1/1/1970 | YES |
|2| 1/1/1970 | 1/20/1970 | NO - 1/1/1970 |
C2 in this example, if we did not have the
TEXT function specified (just had
MIN) it would print
NO - 25569.
Just be sure to update your cell references for the formula (i.e.
B1 should be
B2 and so forth).
Hope that can help.