Formulas & functions

IF

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

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

  1. Select a cell.

  2. Type =IF and a left parenthesis (.

  3. Add the condition you want to test, and type a comma.

  4. Add the value to return if the condition is true, and type a comma.

  5. Add the value to return if the condition is false, and type a right parenthesis ).

  6. Press Enter.

  7. If needed, drag the handle to apply the IF function to other rows.

Want more?

IF function

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.