Presentation is loading. Please wait.

Presentation is loading. Please wait.

Excel IF Function.

Similar presentations


Presentation on theme: "Excel IF Function."— Presentation transcript:

1 Excel IF Function

2 Excel IF Function Purpose Test for a specific condition Return value
The values you supply for TRUE or FALSE Syntax  =IF (logical_test, [value_if_true], [value_if_false]) Arguments  logical_test - A value or logical expression that can be evaluated as TRUE or FALSE. value_if_true - [optional] The value to return when logical_test evaluates to TRUE. value_if_false - [optional] The value to return when logical_test evaluates to FALSE.

3 Excel IF Function Usage notes
Use the IF function to test for or evaluate certain conditions, and then react differently depending on whether the test was TRUE or FALSE. For example, let's say you want to assign either "Pass" or "Fail" to students based on a test score. In that case, you need to test the sore itself (for each student) and then return either "Pass" or "Fail". If you had a score in cell C6, and you wanted to test this score to see if is at least 70, you would use this: C6>=70

4 Excel IF Function This translates as "C6 contains a value greater than or equal to 70". It will either be TRUE or FALSE, depending on the value in C6. You then supply a value that the IF function should return if the test is TRUE, and a value to use if the test is FALSE. Putting it all together, you would use this formula: =IF(C6>=70, "Pass", "Fail") This is the formula that appears D6 in the example shown. When it is copied down the column, it will test every score and return the correct result.

5 Excel IF Function Nested IF statements
You may here the term "Nested IF" or "Nested IF statement". This refers to using more than one IF function so that you can test for more conditions and return more possible results. Each IF statement needs to be carefully "nested" inside another so that the logic is correct. For example, the following formula can be used to assign an grade rather than a pass / fail result: =IF(C6<70,"F",IF(C6<75,"D",IF(C6<85,"C",IF(C6<95,"B","A"))))

6 Excel IF Function Up to 64 IF functions can be nested. However, in general, you should consider other functions, like VLOOKUP or HLOOKUP for more complex scenarios, because they can handle more conditions in much more streamlined fashion. Logical operators When you are constructing a test with IF, you can use any of the following logical operators: Comparison operator Meaning Example = equal to A1=D1 > greater than A1>D1 >= greater than or equal to A1>=D1 < less than A1<d1< td=""></d1<> <= less than or equal to A1<=D1 <> not equal to A1<>D1

7 Excel IF Function Notes:
If any of the arguments to IF are supplied as arrays, the IF function will evaluate every element of the array. To count things conditionally, use the COUNTIF or the COUNTIFSfunctions. To sum things conditionally, use the SUMIF or the SUMIFS functions.

8 Excel IF Function

9 Excel IFERROR Function

10 Excel IFERROR Function
Purpose  Trap and handle errors Return value  The value you specify for error conditions. Syntax  =IFERROR (value, value_if_error) Arguments  value - The value, reference, or formula to check for an error. value_if_error - The value to return if an error is found.

11 Excel IFERROR Function
Usage notes  Use the IFERROR function to trap and handle errors produced by other formulas or functions. IFERROR checks for the following errors: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, or #NULL!. For example, if A1 contains 10, B1 is blank, and C1 contains the formula =A1/B1, the following formula will trap the #DIV/0! error that results from dividing A1 by B1: =IFERROR (A1/B1. "Please enter a value in B1") In this case, C1 will display the message "Please enter a value in B1" if B1 is blank or zero.

12 Excel IFERROR Function
Notes: If value is empty, it is evaluated as an empty string ("") and not an error. If value_if_error is supplied as an empty string (""), no message is displayed when an error is detected. If IFERROR is entered as an array formula, it returns an array of results with one item for each cell in value.

13 Excel IFERROR Function

14 Excel IFS Function

15 Excel IFS Function Purpose Test multiple conditions, return first true
Return value  Value corresponding with first TRUE result Syntax  =IFS (test1, value1, [test2, value2], ...) Arguments  test1 - First logical test. value1 - Result when test1 is TRUE. test2, value2 - [optional] Second test/value pair.

16 Excel IFS Function Usage notes
Use the IFS function to test multiple conditions and return a value corresponding to the first TRUE result. Unlike the IF function, IFS allows you to test more than one condition without nesting. This makes formulas with many conditions easier to read. Arguments are entered in test/value pairs. Each test (condition) represents a logical test that returns TRUE or FALSE, and each value is associated with the previous test. A value is returned by IFS only when its test returns TRUE, and the first test with a TRUE result "wins". The IFS function supports up to 127 conditions.

17 Excel IFS Function In the example shown the formula in E5 is:
=IFS(D5<60,"F",D5<70,"D",D5<80,"C",D5<90,"B",D5>=90,"A") Note: the IFS function is new in Excel 2016 on Windows, and won't work in other versions of Excel. Notes: There is no way to set a default if all tests return FALSE (i.e. a value if false). Instead, enter TRUE for the last test, and then a value to return as a default value if FALSE. All logical tests must return TRUE or FALSE. Other results will case IFS to return a #VALUE! error. If no logical tests return TRUE, IFS returns the #N/A error.

18 Excel IFS Function

19 Excel NOT Function

20 Excel NOT Function Purpose Reverse arguments or results Return value
A reversed logical value Syntax  =NOT (logical) Arguments  logical - A value or logical expression that can be evaluated as TRUE or FALSE. Usage notes  Use the NOT function to reverse a value or logical argument, that is, if logical is FALSE, NOT returns TRUE. If logical is TRUE, NOT returns FALSE.

21 Excel NOT Function Why would you want to do this? A common example is to reverse the behavior of another function. For example, If the cell A1 is blank, then the formula =ISBLANK(A1) will return TRUE. NOT can be used to reverse this result to FALSE like this: =NOT(ISBLANK(A1)) In essence, by adding NOT, you are able to create a formula that behaves like ISNOTBLANK, which doesn't exist in Excel.

22 Excel Or Function

23 Excel OR Function Purpose Test multiple conditions with OR
Return value  TRUE if any arguments evaluate TRUE; FALSE if not. Syntax  =OR (logical1, [logical2], ...) Arguments  logical1 - The first condition or logical value to evaluate. logical2 - [optional] The second condition or logical value to evaluate.

24 Excel OR Function Usage notes
Use the OR function to test multiple conditions at the same time, up to 255 conditions total. For example, to test if the value in A1 OR the value in B1 is greater than 75, use the following formula: =OR(A1>75,B1<75) OR can be used to extend the functionality of functions like IF. Using the above example, you can supply OR as the logical_test for an IF function like so: =IF(OR(A1>75,B1<75), "Pass", "Fail")

25 Excel OR Function This formula will return "Pass" if the value in A1 is greater than 75 OR the value in B1 is greater than 75. If you enter OR as an array formula, you can test all values in a range against a condition. For example, this array formula will return TRUE if any cell in A1:A100 is greater than 15: ={OR(A1:A100>15} Notes: Each logical condition must evaluate to TRUE or FALSE, or be arrays or references that contain logical values. Text values or empty cells supplied as arguments are ignored. The OR function will return #VALUE if no logical values are found

26 Excel OR Function

27 Excel TRUE Function

28 Excel TRUE Function Purpose Generate the logical value TRUE
Return value  The logical value TRUE Syntax  =TRUE () Usage notes  The TRUE function is provided for compatibility with other spreadsheet applications and there is no need to use it in almost all cases.

29 Excel TRUE Function If you want to enter TRUE, or provide TRUE as a result in a formula, you can just use enter the word TRUE directly into a cell or formula and Excel will interpret this as the logical value TRUE. For example, these formulas are functionally identical: =IF(A1<0, TRUE()) =IF(A1<0, TRUE) Also note that logical expressions themselves will automatically generate TRUE and FALSE results. For example, the formula in cell C7 is: =B7>90 This expression evaluates to TRUE, which is the result that appears in the spreadsheet. If you want to test a condition and return different results based on whether the results are TRUE or FALSE, see the examples on this page.

30 Excel TRUE Function

31 Excel ADDRESS Function

32 Excel ADDRESS Function
Purpose  Create a cell address from a given row and column Return value  A cell address in the current or given worksheet. Syntax  =ADDRESS (row_num, col_num, [abs_num], [a1], [sheet]) Arguments  row_num - The row number to use in the cell address. col_num - The column number to use in the cell address. abs_num - [optional] The address type (i.e. absolute, relative). Defaults to absolute. a1 - [optional] The reference style, A1 vs R1C1. Defaults to A1 style. sheet - [optional] The name of the worksheet to use. Defaults to current sheet.

33 Excel ADDRESS Function
Usage notes  Use ADDRESS to create an address from a given row and column number. For example, ADDRESS(1,1,) will return $A$1. Abs_num key: 1 or omitted  Absolute 2  Absolute row; relative column 3  Relative row; absolute column 4  Relative

34 Excel AREAS Function

35 Excel AREAS Function Purpose Get the number of areas in a reference.
Return value  A number representing number of areas. Syntax  =AREAS (reference) Arguments  reference - A reference to a cell or range of cells. Usage notes  Reference can include more than one reference. you must separate multiple references with a comma and wrap then in an extra set of parentheses. Otherwise, Excel will think the commas indicate multiple parameters and generate an error. As an example, the formula =AREAS((F17:F19,J16:J18,I8)) will return 3.

36 Excel CHOOSE Function

37 Excel CHOOSE Function Return value The value at the given position.
Syntax  =CHOOSE (index_num, value1, [value2], ...) Arguments  index_num - The value to choose. A number between 1 and 254. value1 - The first value from which to choose. value2 - [optional] The second value from which to choose. Usage notes  Choose can handle up to 254 values. Index_num returns a value based on it's position in the list. For example, if index_num is 2, value2 is returned. Values can also be references. For example, the address A1, or the ranges A1:10 or B2:B15 can be supplied as values.

38 Excel CHOOSE Function

39 Excel COLUMN Function

40 Excel COLUMN Function Purpose Return value Syntax Arguments
Get the column number of a reference. Return value  A number representing the column. Syntax  =COLUMN ([reference]) Arguments  reference - [optional] A reference to a cell or range of cells. Usage notes  Use reference to get column number of a reference. Reference can be a single cell address or a range of cells. Reference is optional and will default to the cell in which the COLUMN function exists. Reference cannot include multiple references or addresses.

41 Excel COLUMNs Function

42 Excel COLUMNS Function
Purpose  Get the number of columns in an array or reference. Return value  A number representing column count. Syntax  =COLUMNS (array) Arguments  array - A reference to a range of cells. Usage notes  Use the COLUMNS function to get the number of columns in a reference. For example, the formula =COLUMNS(A1:F1) returns the number 6. Array can be an array, an array formula, or a reference to a single contiguous group of cells.

43 Excel FORMULATEXT Function

44 Excel FORMULATEXT Function
Purpose  Get the formula in a cell Return value  The formula as text Syntax  =FORMULATEXT (reference) Arguments  reference - Reference to cell or cell range. Usage notes  You can use the FORMULATEXT function to extract a formula as text from a cell. Once extracted, you can work with the formula like any other text.

45 Excel FORMULATEXT Function
Remember that you can temporarily display all formula in a worksheet with a keyboard shortcut. If you just want to test to see if a cell contains a formula or not, use the ISFORMULA function. Notes: If you use FORMULATEXT on a cell that doesn't contain a formula, you'll get an #N/A error. You can reference another workbook, but if the workbook is not open, you'll get an #N/A error. FORMULATEXT was introduced in Excel 2013.

46 Excel FORMULATEXT Function

47 Excel HLOOKUP Function

48 Excel HLOOKUP Function
Purpose  Look up a value in a table by matching on the first row Return value  The matched value from a table. Syntax  =HLOOKUP (value, table, row_index, [range_lookup]) Arguments  value - The value to look up. table - The table from which to retrieve data. row_index - The row number from which to retrieve data. range_lookup - [optional] A boolean to indicate exact match or approximate match. Default = TRUE = approximate match.

49 Excel HLOOKUP Function
Usage notes  HLOOKUP searches for a value in the first row of a table. At the match column, it retrieves a value from the specified row. Use HLOOKUP when lookup values are located in the first row of a table. Use VLOOKUP when lookup values are located in the first column of a table. Range_lookup controls whether value needs to match exactly or not. The default is TRUE = allow non-exact match. Set range_lookup to FALSE to require an exact match.

50 Excel HLOOKUP Function
If range_lookup is TRUE (the default setting), a non-exact match will cause the HLOOKUP function to match the nearest value in the table that is still less than value. When range_lookup is omitted, the HLOOKUP function will allow a non-exact match, but it will use an exact match if one exists. If range_lookup is TRUE (the default setting) make sure that lookup values in the first row of the table are sorted in ascending order. Otherwise, HLOOKUP may return an incorrect or unexpected value. If range_lookup is FALSE (require exact match), values in the first row of table do not need to be sorted.


Download ppt "Excel IF Function."

Similar presentations


Ads by Google