Solved IF statement using OR

August 21, 2012 at 07:48:24
Specs: Macintosh
I am attempting to enter an =IF(OR.. statement to provide a "1" in the output cell if any one of the conditions are true, and a blank cell if none of the conditions are true. One of the conditions I want to enter is if the sum of two cells is greater than or equal to two, than the statement would be true. However, I am having trouble including a sum in the IF(OR) formula. Excel provides an error (######) in the cell, when I attempt to enter it. Currently, I am entering =IF(OR(H14>=1,O14>=2, (SUM(H14+O14)>=2),1,""), which is when I receive the error message. If I take out the condition that includes the SUM, it works fine, so I know that is where the issue lies. Please help!

See More: IF statement using OR

August 21, 2012 at 09:38:33
✔ Best Answer
Well, there are few things I see about your formula that we should discuss.

First, let's start with the SUM function.

Typically, a SUM function uses a comma between the arguments, not a plus sign, or you could use just a plus sign and not the SUM function. These two formulas are equivalent:


While SUM(H14+O14) will work in your case, it's really not doing what you think it is.

What you are actually doing with that syntax is adding H14 and O14 inside the parenthesis and then using SUM to add that total to, well, nothing.

Just like =SUM(91) will return 91 since you didn't give the SUM function anything to SUM, SUM(H14+O14) will simply return whatever H14+O14 returns and not really do anything with the SUM function.

Excel's "order of operations" will add the values inside the parenthesis first, and then use the SUM function on the arguments within the parenthesis. Once the H14+O14 operation is complete, you'll only have one argument for the SUM function to work on, so it won't really do anything.

Second, the error I get when I try your formula is a message saying:

"Your formula is missing a parenthesis--) or (,Check the formula, and then add the parenthesis in the appropriate place"

I think you are looking for this:

=IF(OR(H14>=1,O14>=2, SUM(H14,O14)>=2),1,"")

Third, assuming the above formula is corect, wouldn't this shorter version get you what you are looking for?

=IF(OR(H14>=1, SUM(H14,O14)>=2),1,"")

If you want to return a 1 when SUM(H14,O14) is >=2, then sort of by default, SUM(H14,O14) will always be >=2 if O14 is >=2. Therefore, why bother checking if O14 is >=2 by itself?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •
Related Solutions

Ask Question