Tutorial: Obchodní akademie Topic: Logical Functions Prepared by: Mgr. Zdeněk Hrdina Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/ je spolufinancován Evropským sociálním fondem a státním rozpočtem České republiky.
Allows to add decision making into formulas IF(condition, yes, no) ◦ condition – any value or expression that can have the logical values TRUE or FALSE ◦ yes – value returned by the function if the condition evaluates to TRUE ◦ no - value returned by the function if the condition evaluates to FALSE
comparison with a reference: e.g. A1>C3 comparison with a numeric value: e.g. A1>3 comparison with a text string: e.g. A1="bank" (text strings need to be enclosed in quotation marks) comparison with a date or time: We cannot use a simple comparison as in A1=" " A1=VALUE(" ") A1=DATE(2011;1;1) It is possible to use a comparison with a reference to a cell with a date
The typical usage of the IF function is when there are only two possible situations (condition met x condition not met) If there are more possible situations (3 and more), it is possible to use nested IF functions (starting with Excel 2007 you can use up to 63 nested IF functions)
It is used when there are multiple conditions which need to be met at the same time AND(condition1, condition2,…) ◦ condition1 - any value or expression that can have the logical values TRUE or FALSE ◦ up to 255 conditions can be used ◦ The result of the function is TRUE if all the conditions are met at the same time, if at least one condition evaluates to FALSE, the result of the function is FALSE
It is used when there are multiple conditions, and it is enough if only one of them is met OR(condition1, condition2,…) ◦ condititon1 - any value or expression that can have the logical values TRUE or FALSE ◦ The result of the function is TRUE if at least one condition is met, if no condition is met, the result of the function is FALSE
Example 1: we need to determine whether the value in cell A1 is in the interval from 10 to 20 Example 2: if the value in cell A1 is equal to Praha or Brno, the result should be “city”, otherwise “town”
Solve the given task. zadání.xlsx zadání.xlsx
BARILLA, Jiří, Pavel SIMR a Květuše SÝKOROVÁ. Microsoft Excel 2010: Podrobná uživatelská příručka. Brno: Computer Press, ISBN WALKENBACH, John. Microsoft Excel - vzorce a funkce. Praha: Mobil Media a.s., ISBN Microsoft Office. MS EXCEL Funkce - Logické [online] [ ].