1
votes

'Worksheet1'!A2 contains a date.

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 "".

Example

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.

1

1 Answers

1
votes

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