Occasional Visitor

Hi everyone, I would need help, I'm new in IF function, so I would be happy of your help. How should I write IF fomula IF for:

I have one cell C14 with word HB in it and one cell with the dates and in the third cell I should write IF function so that 2 conditions would be true than it should write YES, iof both conditions are not TRUE than it should be NO in the cell, for example:


IF cell C14 = HB and M14 = DATE 27.10.2022 than YES, otherwise NO

I thought it should be

IF(AND(C14="HB", M14=datevalue("27.10.2022"), "YES", "NO"))


But this is not working. 


Can somebody help me?



3 Replies


=IF(AND(C14="HB", M14=DATEVALUE("27.10.2022")), "YES", "NO")

You can try this formula. 

@JasminajudoSLO You may try below formula.

=IF((C14="HB")*(M14=DATE(2022,10,27)), "YES", "NO")

 Remember datevalue("27.10.2022") shouldn't work as "27.10.2022" couldn't be recognized as date value. In Excel dot (.) is not date separator until you manually change date separator from control panel. DATEVALUE("27-Oct-2022") should work in this way.

=IF((C14="HB")*(M14=DATEVALUE("27-Oct-2022")), "YES", "NO")



27.10.2022 is considered as text in Excel, So simply write formula like
IF(AND(C14="HB", M14="27.10.2022"), "YES", "NO"))
Date value will not be converted to value unless it is in proper format like Month/Date/Year or Date/Month/Year setting in Excel i.e. 10/27/2022 or 27/10/2022