ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validate same month and same year (https://www.excelbanter.com/excel-programming/431039-validate-same-month-same-year.html)

salgud

Validate same month and same year
 
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?

Lars-Åke Aspelin[_2_]

Validate same month and same year
 
On Mon, 13 Jul 2009 08:53:09 -0600, salgud
wrote:

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



salgud

Validate same month and same year
 
On Mon, 13 Jul 2009 14:54:58 GMT, Lars-Åke Aspelin wrote:

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


Thanks Lars!


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com