![Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.](https://cxcs.microsoft.net/static/public/surface-and-devices/neutral/4873755a-8b1e-497e-bc54-101d1e75d3e7/d07c07fd6aabfe12ed716e87301dc3a1a3a7b5b0.png)
Try it!
Use IF to return a value based on a condition.
For example, =IF(C2=”Yes”,1,2) says IF(C2 = Yes, then return a 1, otherwise return a 2).
IF
-
Select a cell.
-
Type =IF and a left parenthesis (.
-
Add the condition you want to test, and type a comma.
-
Add the value to return if the condition is true, and type a comma.
-
Add the value to return if the condition is false, and type a right parenthesis ).
-
Press Enter.
-
If needed, drag the handle to apply the IF function to other rows.