Related topics
×
Formulas & functions
Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.
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.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×