Trish
Trish

Reputation: 11

Formula creation - date comparison

I'm trying to construct an Excel formula which compares the date in column A to the date in column B and tells me YES if they are the same date, tells me NO if they are different dates, then if NO tells me what is the oldest of the two dates.

What I have is not working:

=IF(A1=B1,"YES","NO"&(A1,B1))

Upvotes: 1

Views: 64

Answers (1)

D_Bester
D_Bester

Reputation: 5901

=IF(A1=B1,"YES","NO "&TEXT(MIN(A1,B1),"mm/dd/yyyy"))

Or if you just want the oldest date without the "NO" then do this (be sure to format cell as date):

=IF(A1=B1,"YES",MIN(A1,B1))

Upvotes: 1

Related Questions