Call us at:   1.805.498.7162    

Microsoft Excel workshops for business, engineering and science Innovative Microsoft Excel software design View our customer list from our over 14 years in business Phone numbers, email address and contact form Learn about EMAGENIT Home page containing upcoming Microsoft Excel classes and other EMAGENIT services Self-study Microsoft Excel manuals for business, engineering and science Microsoft Excel consulting services Microsoft Excel training schedule and prices

Home > Excel Resources > Excel IF Function

Microsoft Excel IF Function Help

Microsoft Excel IF Function Help

IF Function Tutorial

The IF Function can evaluate a TRUE/FALSE condition and return one of two values based on whether a TRUE was evaluated or a FALSE was evaluated.

 
 
Function Specifics

 

What is the Microsoft Excel IF Function?

The IF function is a computer program that you run from a worksheet cell formula. It can evaluate a TRUE/FALSE condition and return one of two values based on whether a TRUE was evaluated or a FALSE was evaluated.  You run the IF worksheet function by typing its name in a formula then followed by the information it is suppose to use. The IF function is generally used to make a decision in a worksheet formula thus providing logic for your worksheet. The decision as well as the values the function returns can be a great many things. A common use for the IF function would be to calculate different formulas based upon its TRUE/FALSE decision. For example, if you are calculating a sale and want to give the customer a 10% discount if the sale is above $400.00 then you would use the IF function to accomplish such a task. The IF worksheet function is also heavily used in summarizing data and in protecting against worksheet errors (error protection).

 

How Do You Type the IF Worksheet Function in a Formula?

Whenever you type a formula in a worksheet cell, this is called syntax or grammar. The general IF function syntax has a format like this when you type it in a worksheet cell:

=IF(logical_test, [value_if_true], [value_if_false])

Where logical_test, [value_if_true], [value_if_false] are called the function argument list. Remember, you are running a computer program at this point so the program needs information to operate and that is why there is an argument list. When you see an argument list and you see square brackets [ ] around the argument name, this means the argument is optional and you do not have to include it when typing unless you need it. So for the syntax above, you need to include one argument for the IF function when typing it in a worksheet cell formula in order for it to calculate correctly. What argument values can be used are discussed below. Remember functions expect certain things in their argument lists, if you do not put the correct information in the list they will generate an error when run.

IF Worksheet Function Argument Definitions

  • logical_test: This can be any value, formula or nested function that can be evaluated to TRUE / FALSE. For example, B6*B7>=400 is a formula that calculates to TRUE or FALSE . The following relational operators and symbols can be used to build the logical test formula:

    • Less than:  <

    • Greater than:  >

    • Less than or equal to:  <=

    • Greater than or equal to:  >=

    • Not equal to:  <>

    • Equal to:  =

    • Concatenation Operator: &

    In addition to these operators, any function that produces TRUE/FALSE can be nested and used as the first argument of this function. Common functions to use for this argument are the AND, OR, NOT and IS functions

  • value_if_true Optional: This is the value that you want to be returned if the logical_test argument evaluates to TRUE. This again can be any value, formula or nested function that generates a value.

  • value_if_false Optional: This is the value that you want to be returned if the logical_test argument evaluates to FALSE. This again can be any value, formula or nested function that generates a value.

 

How Do You Run the IF Function?

Since the IF function is a computer program, it runs when you press Enter to enter the formula that contains it. If any of the arguments are wrong, the function will return an error.

 

What Do I Type for a IF Function Argument?

When typing the IF function in a worksheet cell formula, you need to replace the argument list with arguments separating each one with a comma (,). Some typical arguments you can use are:

Argument Type Cell Formula Example Explanation
Cell References and Formulas =IF(B6*B7>=400, B6*B7*.9, B6*B7) IF the logical condition for the IF function evaluates to TRUE then the value from B6*B7*.9 is returned. If FALSE then the value for B6*B7 is returned
Nested Functions =IF(ISERROR(A10/A11), 0, A10/A11) IF the logical condition for the IF function finds an error with the formula A1/A11 then 0 is returned. If ISERROR evaluates to false then the value for A10/A11 is returned (basic formula error protection)
Cell and Range Names =IF(Wires, 100, 0) IF the cell name wires has a TRUE value, means TRUE is calculated in the cell, then 100 is returned. This strategy is great for adding options. What generates TRUE in the Wires cell can be anything from an ActiveX control output to a formula.

* It is possible to name a cell or group of cells on a worksheet and use that name in place of a range reference or cell reference. Consult Excel help on how to name a cell.

Need Help?

Let our Microsoft Excel workshops below show you how to use the worksheet function that you see on this page and more. They are unlike anything taught on the training market today.

Microsoft Excel Workshops -  Free RepeatsFree Workshop Repeats

All of our workshops come with free repeats. We understand learning takes time. Details

Intermediate Microsoft Excel Workshop

Intermediate Microsoft Excel WorkshopLearn productive Microsoft Excel solution skills that will save you time and effort in your daily Excel tasks. Drawing from our 15 years' of experience, our 1-day "hands-on" Microsoft Excel workshop shows you how to use Excel's formulas, cell naming features, worksheet functions like VLOOKUP, built-in data tools, charts and pivot tables to solve your daily business problems. Complete Outline and Signup

Advanced Microsoft Excel Workshop

Advanced Microsoft Excel WorkshopLearn how to use the advanced Microsoft Excel features that you need to succeed in your business. Drawing from our 15 years' of experience, our 1-day "hands-on" Excel workshop shows you how to create advanced formulas that think and scan, use Excel's advanced data tools to extract external data, construct advanced pivot tables and pivot charts, and use ActiveX controls to build dashboards. It also provides an introduction to VBA macros. Complete Outline and Signup

Advanced Microsoft Excel for Engineers and Scientists

Microsoft Excel Workshop for Engineers and ScientistsLearn how to use Microsoft Excel to create advanced engineering and science tools. Drawing from our 15 years' of experience, our 1-day "hands-on" workshop shows how to create advanced formulas that think and scan, perform numerical analysis tasks on the worksheet, use Excel's advanced data and statistical tools, construct advanced pivot tables, build and optimize system models, and use ActiveX controls to build technical dashboards. It also provides an introduction to VBA macros. Taught by an engineer. Complete Outline and Signup

 

Additional IF Function Examples

The worksheet seen below contains some typical worksheet formulas that run the IF worksheet function. Pay close attention to the argument list and the syntax used to write the formula.

  A B C D E
1 Region A      
2 Price $19.99    

 

3 Quantity      

 

4        

 

5          
6 Region A      
7 Price $19.99      
8 Quantity 20      
9          
10 Sub Total =IF( AND(ISNUMBER(B7), ISNUMBER(B8)) , B7*B8, "")  

Use AND , ISNUMBER functions as logical argument to IF function and determine if B7*B8 should be calculated if numbers present in B7, B8 or "" returned.

           

 

Things to Know About the IF Function

  • If creating nested IF functions, up to 64 IF functions can be nested in the value_if_true and value_if_false arguments. Alternatively, you may consider consider using the LOOKUP, VLOOKUP, HLOOKUP, or CHOOSE functions if you are trying to perform a table lookup.

  • If using arrays or ranges to build any of the arguments of the IF, every element of the array is evaluated when the IF statement is run.

  • Be sure to check out the COUNTIF, COUNTIFS, SUMIF or SUMIFS worksheet functions. These functions also include logic tests and are geared to counting or summing TRUE conditions.

 

Back to Help Topics

 

 

 

 

Site Map

Copyright 2002-2014 EMAGENIT All Rights Reserved