How do I use the MONTH() function inside an IF/AND function in excel

155 views Asked by At

I am trying to make a sheet where excel grabs the month from a date in a cell as well as the "type" from another cell if those results are true it returns a 1 and if not returns a 0. I also want it to add the rows in the column but that will probably just mean adding SUM() to the front before the IF statement. Here is what I have so far but it won't function.

=IF(AND(MONTH($I2) = 11, $K2 = "Yes") $C2 = "Simple",1,0)

So here we have if the month in cell I2 is November (11) and the value of the string in K2 is "Yes" and the value in cell C2 is "Simple" then return 1 other wise return 0.

I have done research online but I am starting to think that this is not possible? Maybe there is a different way through VLOOKUP? Not sure which way to go.

I have found the correct way to do this however it seems that Excel does not want to add the different values it finds when adding ranges to the function such as

=SUM(IF(AND(MONTH($I2:$I1000)=11,$K2:$K1000="Yes",$C2:$C1000="Simple"),1,0))
2

There are 2 answers

11
Terry W On BEST ANSWER

Try

=SUMPRODUCT((MONTH($I2:$I1000)=11)*($K2:$K1000="Yes")*($C2:$C1000="Simple"))

SUMPRODUCT works as COUNTIFS in this case which examines the three criteria and return the total count as a result.

2
Regiz On

The function which u mentioned in your question seems incorrect.

you have closed the ")" before the third condition. Hence the formula won't worked.

your formula (Error Formatted in Bold)

IF(AND(MONTH($I2) = 11, $K2 = "Yes") $C2 = "Simple",1,0)

The Exact Formula which will be worked out. Try This one.

=IF(AND(MONTH($I2) = 11, $K2 = "Yes",$C2 = "Simple"),1,0)