ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   IF month and day match, then... (https://www.excelbanter.com/excel-worksheet-functions/116195-if-month-day-match-then.html)

RS

IF month and day match, then...
 
Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.

Ron Coderre

IF month and day match, then...
 
Try something like this:
=IF(TEXT(C8,"MMDD")="1026","text","no match")

The reason this doesn't work: =IF(C8=AND(MONTH(10),DAY(26)),"text")
is that the AND() function regards any positive value as TRUE.
Since MONTH(10) is greater than 0 and DAY(26) is greater than 0,
then AND(MONTH(10),DAY(26)) returns TRUE


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"RS" wrote:

Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.


smw226 via OfficeKB.com

IF month and day match, then...
 
Hi RS,

You were very close,

=IF(AND(MONTH(C8)=10,DAY(C8)=26),"text")


HTH

Simon

RS wrote:
Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200610/1


RS

IF month and day match, then...
 
Dear Ron,

Sorry for the delay but this was the first chance I got to look at
these solutions. Thanks for your suggestion, the formula you provided works
great! Thank you.

"Ron Coderre" wrote:

Try something like this:
=IF(TEXT(C8,"MMDD")="1026","text","no match")

The reason this doesn't work: =IF(C8=AND(MONTH(10),DAY(26)),"text")
is that the AND() function regards any positive value as TRUE.
Since MONTH(10) is greater than 0 and DAY(26) is greater than 0,
then AND(MONTH(10),DAY(26)) returns TRUE


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"RS" wrote:

Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.


RS

IF month and day match, then...
 
Dear smw226,

Sorry for the delay but this was the first chance I got to look at
these solutions. Thanks for your correction to my formula, it now works!
It's nice to see that I was on the right track. With the guidance of people
such as you and Ron in this forum, I am learning to look for help here rather
than waste hours trying to solve an incorrect formula...and in this process,
I'm increasing my Excel knowledge! Thanks to everyone!


"smw226 via OfficeKB.com" wrote:

Hi RS,

You were very close,

=IF(AND(MONTH(C8)=10,DAY(C8)=26),"text")


HTH

Simon

RS wrote:
Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200610/1



RS

IF month and day match, then...
 
Quick update: How would I modify the formula to include other dates? I
tried the following but get an #VALUE! error:
=IF(TEXT(C8,"MMDD")=OR("1031","0115","0417"),"text ","")

"Ron Coderre" wrote:

Try something like this:
=IF(TEXT(C8,"MMDD")="1026","text","no match")

The reason this doesn't work: =IF(C8=AND(MONTH(10),DAY(26)),"text")
is that the AND() function regards any positive value as TRUE.
Since MONTH(10) is greater than 0 and DAY(26) is greater than 0,
then AND(MONTH(10),DAY(26)) returns TRUE


Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"RS" wrote:

Hi everyone. Simple question...how would I correct my formula such that if
the date in C8 is a certain date (regardless of the year!), then... The
formula I tried is: =IF(C8=AND(MONTH(10),DAY(26)),"text") where
C8=TODAY(). When I click on the AND in the wizard it says both statements
are TRUE but if I click before the AND, it says FALSE.

Alternatively, I also tried: =IF(TODAY()=AND(MONTH(10),DAY(26)),"text").
However in the wizard, the result is "Volatile" and the cell displays FALSE.



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

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