Validate same month and same year

S

salgud

Got help here figuring out the formula to validate that 2 dates in another
cell (not the one with the validation formula) were for the same month. I
now need to validate they are both the same month and year.
I've tried:
=MONTH(H7)=MONTH(I7)and=year(H7)=year(I7)
which XL doesn't accept. I tried
=(MONTH(H7)=MONTH(I7))and(year(H7)=year(I7))
but that doesn't work either.
Any suggestions?
 
L

Lars-Åke Aspelin

Got help here figuring out the formula to validate that 2 dates in another
cell (not the one with the validation formula) were for the same month. I
now need to validate they are both the same month and year.
I've tried:
=MONTH(H7)=MONTH(I7)and=year(H7)=year(I7)
which XL doesn't accept. I tried
=(MONTH(H7)=MONTH(I7))and(year(H7)=year(I7))
but that doesn't work either.
Any suggestions?


Try this formula:

=AND(MONTH(H7)=MONTH(I7),YEAR(H7)=YEAR(I7))

Hope this helps / Lars-Åke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top