# EXCEL IF....

Occasional Visitor

# EXCEL IF....

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?

TNX

3 Replies

# Re: EXCEL IF....

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

You can try this formula.

# Re: EXCEL IF....

@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")

# Re: EXCEL IF....

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
https://support.microsoft.com/en-us/office/datevalue-function-df8b07d4-7761-4a93-bc33-b7471bbff252