Compare month and day (not year) in Excel

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Compare month and day (not year) in Excel



'Worksheet1'!A2 contains a date.


'Worksheet1'!A2



If the month and day of A2 are between 0 and 7 days after today's month and day, I want B2 to equal A2. Otherwise, B2 should equal "".


A2


B2


A2


B2



enter image description here



In other words, ignoring the years, if the month and day of A2 are within 7 days of today, I want B2 to display A2 with the year being the same as the current year. Otherwise, I want B2 to display nothing.


A2


B2


A2


B2




1 Answer
1



then just subtract the date as if it is this year and check discrepancy.


=IF(OR(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()=0,1,2,3,4,5,6,7),A2,"")



enter image description here





Great solution, Scott! Dusty, if you want A2 to have the same year as the current year, use =IF(OR(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()=0,1,2,3,4,5,6,7),DATE(YEAR(TODAY()),MONTH(A2),DAY(A2)),""). I may have I misinterpreted that part of your question, though.
– TotsieMae
Aug 7 at 21:52


A2


=IF(OR(DATE(YEAR(TODAY()),MONTH(A2),DAY(A2))-TODAY()=0,1,2,3,4,5,6,7),DATE(YEAR(TODAY()),MONTH(A2),DAY(A2)),"")






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard