This is an extract from our pre-course videos for our renewable energy and infrastructure project finance modeling course.
Now you have the IF statement down, your boss sees you as the go to person for Excel, and they ask ow if you can check if the company spending was equal to the target spending in this year or the previous one, not just in one year. And with the IF statement earlier we checked only one condition, being if A2 equaled B2, but now I’ve been asked to check two conditions, and Excel has a function for me. It’s called the IF(OR) function using two or more conditions. It’s constructed as equals IF open parentheses, OR, open parentheses, condition 1, condition 2, condition N, closed parentheses. Then, value of true, value of false. So here we can type =IF(OR(A2=B2, A3=B3),1,0). And we’re looking at both the conditions of A2=B2 and A3=B3. If only one of those is true, then we get a true result and given A3 does equal B3, the condition is true and we get a value of 1.
But I can also check if the extra spending was equal to the budget spending in year one and year two. Not all. It’s exactly the same function as with IF(OR), except we replace here OR with AND. So we can type =IF(AND(A2=B2, A3=B3),1,0). And A2=B2, A3=B3 is false because A2 doesn’t equal B2 so the IF statement equals 0. So now you know how to test multiple conditions, as you will see in this course, this will become second nature to you as we will require this sort of calculation all of the time.