I need an excel formula

I need an excel formula to look at two different cells and see if they have the same data. However, once cell is formatted with just "12" and the other is formatted as "12th."

I have tried using the following that are not working, returning NO when it should be YES

=IF(A1=A2,"YES","NO")
=IF(RIGHT(A2,2)=A1,"YES","NO")

See attached.
10-6-11.xlsx
LVL 1
wrt1meaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sah18Commented:
Well, 12 and 12th are not the same.  Are you wanting them to be considered to be the same?  What other types of data will you have in your column?
0
McOzCommented:
use this:

=IF(VALUE(LEFT(A2,2))=A1,"YES","NO")

otherwise it is trying to compare a string to a number.

McOz
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wrt1meaAuthor Commented:
What I am tryiing to do is using a count function on a sheet to make sure end users have entered something in for everyday of the month. So when the count returns 31 for the total days in October, I need it to look at the last cell that has "31st" and tell me YES or NO.
0
wrt1meaAuthor Commented:
WORKS GREAT!
0
sah18Commented:
Ahh, that is clearer now.  The equation provided by McOz above will do what you want.
Let us know if that is not what you intended.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.