Edit this Article
Add the OR operator.
The OR function follows the format
OR(condition 1, condition 2)
. If either condition is true, the entire OR argument will be true. If both conditions are false, the OR argument will evaluate to false.
-
Continuing our example,
=IF(OR(A1=B1, A1=C1), "yes", "no")
checks whether A1 equals B1 or C1.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/1\/1c\/Use-If%E2%80%90Else-in-Excel-Step-9-Version-2.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-9-Version-2.jpg","bigUrl":"\/images\/thumb\/1\/1c\/Use-If%E2%80%90Else-in-Excel-Step-9-Version-2.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-9-Version-2.jpg","smallWidth":460,"smallHeight":346,"bigWidth":728,"bigHeight":547,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Add the NOT operator.
The NOT function follows the format
NOT(condition)
. If the condition is true, the NOT argument will be false. If the condition is false, the NOT argument will be true.
-
Continuing our example,
=IF(NOT(A1=B1), "yes", "no")
checks whether A1 does not equal B1.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/6\/64\/Use-If%E2%80%90Else-in-Excel-Step-2.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-2.jpg","bigUrl":"\/images\/thumb\/6\/64\/Use-If%E2%80%90Else-in-Excel-Step-2.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-2.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Open a
Blank Document
in Excel.
If Excel has already opened to a blank spreadsheet, you can skip this step. For this method, we’ll work with a blank document to create an example formula.
In this example formula, we’ll say that if the value of A1 is greater than 5, multiply it by 1. If the value is less than or equal to 5, multiply it by 2.
The end result of this formula will look like this:
=IF(A1>5, A1*1, IF (A1<5, A1*2, A1*2))
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/0\/0d\/Use-If%E2%80%90Else-in-Excel-Step-3.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-3.jpg","bigUrl":"\/images\/thumb\/0\/0d\/Use-If%E2%80%90Else-in-Excel-Step-3.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-3.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type
2
into A1 and press
↵
Enter
.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/5\/5f\/Use-If%E2%80%90Else-in-Excel-Step-4.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-4.jpg","bigUrl":"\/images\/thumb\/5\/5f\/Use-If%E2%80%90Else-in-Excel-Step-4.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-4.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Double-click cell B1.
This is where you’ll type the example formula.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/a\/a4\/Use-If%E2%80%90Else-in-Excel-Step-5.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-5.jpg","bigUrl":"\/images\/thumb\/a\/a4\/Use-If%E2%80%90Else-in-Excel-Step-5.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-5.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type
=IF(
into the cell.
This starts the formula.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/5\/50\/Use-If%E2%80%90Else-in-Excel-Step-6.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-6.jpg","bigUrl":"\/images\/thumb\/5\/50\/Use-If%E2%80%90Else-in-Excel-Step-6.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-6.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type the first condition, followed by a comma.
This is the first test you’ll be performing.
In our example, we want a certain action to occur if the value of A1 is greater than 5. Type
A1>5,
.
The formula should now read
=IF(A1>5,
, which means “if the number inside A1 is greater than 5.”
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/b\/b3\/Use-If%E2%80%90Else-in-Excel-Step-7.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-7.jpg","bigUrl":"\/images\/thumb\/b\/b3\/Use-If%E2%80%90Else-in-Excel-Step-7.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-7.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type the desired output if true.
This is the action you want to occur if the result of the first condition is true.
In this example, we want the value to be multiplied by 1 if it’s greater than 5. So, type
A1*1
.
The formula now looks like this:
=IF(A1>5, A1*1
. This means “if the value of A1 is greater than five, multiple the value by 1.”
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/a\/a4\/Use-If%E2%80%90Else-in-Excel-Step-8.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-8.jpg","bigUrl":"\/images\/thumb\/a\/a4\/Use-If%E2%80%90Else-in-Excel-Step-8.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-8.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type a
,
(comma) and press the spacebar.
The formula should now look like this:
=IF(A1>5, A1*1,
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/2\/22\/Use-If%E2%80%90Else-in-Excel-Step-9.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-9.jpg","bigUrl":"\/images\/thumb\/2\/22\/Use-If%E2%80%90Else-in-Excel-Step-9.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-9.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type
IF(
after the space.
Now you’re ready to add the second part of the formula.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/0\/00\/Use-If%E2%80%90Else-in-Excel-Step-10.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-10.jpg","bigUrl":"\/images\/thumb\/0\/00\/Use-If%E2%80%90Else-in-Excel-Step-10.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-10.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type the second condition, followed by a comma.
This is the second test you’ll perform on the value of A1.
In our example, we want to specify an action to occur if A1 is less than 5. So, type
A1<5
.
The formula should now read:
=IF(A1>5, A1*1, IF(A1<5,
.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/8\/83\/Use-If%E2%80%90Else-in-Excel-Step-11.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-11.jpg","bigUrl":"\/images\/thumb\/8\/83\/Use-If%E2%80%90Else-in-Excel-Step-11.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-11.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type the desired output if true, followed by a comma.
This is the action you want to occur if A1 is less than 5.
In this example, we want the value to be multiplied by 2 if it’s less than 5. So, type
A1*2,
.
The formula now looks like this:
=IF(A1>5, A1*1, IF(A1<5, A1*2,
.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/f\/f7\/Use-If%E2%80%90Else-in-Excel-Step-12.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-12.jpg","bigUrl":"\/images\/thumb\/f\/f7\/Use-If%E2%80%90Else-in-Excel-Step-12.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-12.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type the desired output is false.
Since we’re doing a greater/less than operation, the only value that could be false is 5, since we’re checking for numbers that are greater or less than 5.
In our example, we want the equal-to value to be multiplied by 2. So, you’ll type
A1*2
.
The formula should now look like this:
=IF(A1>5, A1*1, IF(A1<5, A1*2, A1*2
. This means that if the value of A1 is equal to 5, it will be multiplied by 2.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/8\/8d\/Use-If%E2%80%90Else-in-Excel-Step-13.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-13.jpg","bigUrl":"\/images\/thumb\/8\/8d\/Use-If%E2%80%90Else-in-Excel-Step-13.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-13.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Type
))
.
This ends both nested IF statements, as each needs their own “)” mark.
-
The formula now looks like this:
=IF(A1>5, A1*1, IF(A1<5, A1*2, A1*2))
.
{"smallUrl":"https:\/\/www.wikihow.com\/images\/thumb\/e\/e4\/Use-If%E2%80%90Else-in-Excel-Step-14.jpg\/v4-460px-Use-If%E2%80%90Else-in-Excel-Step-14.jpg","bigUrl":"\/images\/thumb\/e\/e4\/Use-If%E2%80%90Else-in-Excel-Step-14.jpg\/v4-728px-Use-If%E2%80%90Else-in-Excel-Step-14.jpg","smallWidth":460,"smallHeight":345,"bigWidth":728,"bigHeight":546,"licensing":"<div class=\"mw-parser-output\"><p>License: <a target=\"_blank\" rel=\"nofollow noreferrer noopener\" class=\"external text\" href=\"https:\/\/en.wikipedia.org\/wiki\/Fair_use\">Fair Use<\/a> (screenshot)<br>\n<\/p><\/div>"}
Press
↵
Enter
.
This runs the formula and displays the result in cell B1. The example result should be 4, because the since the value of A1 (which is 2) is less than 5, it has been multiplied by 2.
200 characters left
Include your email address to get a message when this question is answered.
Submit
This article was co-authored by wikiHow staff writer,
Kyle Smith
. Kyle Smith is a wikiHow Technology Writer, learning and sharing information about the latest technology. He has presented his research at multiple engineering conferences and is the writer and editor of hundreds of online electronics repair guides. Kyle received a BS in Industrial Engineering from Cal Poly, San Luis Obispo. This article has been viewed 122,844 times.