Contenu du cours
Google Spreadsheets
Google Spreadsheets
2. Formatting of Cells and Ranges
IF and Nested IF Functions
IF Function
The IF function checks a condition and returns one value if the condition is true and another value if it is false.
Syntax
IF(logical_expression, value_if_true, value_if_false)
- logical_expression - An expression or reference to a cell containing an expression that represents a logical value, i.e., TRUE or FALSE;
- value_if_true - The value returned by the function if logical_expression is TRUE;
- value_if_false - OPTIONAL−blankbydefaultOPTIONAL - blank by default - The value returned by the function if logical_expression is FALSE.
Nested IF Function
Nested IF allows you to evaluate multiple conditions sequentially. Each subsequent condition is checked if the previous one is false. This is useful when decisions need to be made based on several conditions.
Syntax
IF(condition1, value_if_true1, IF(condition2, value_if_true2, value_if_false2))
- condition1 - An expression or reference to a cell that evaluates the first condition being checked;
- value_if_true1 - The value returned by the function if condition1 is TRUE;
- condition2 - An expression or reference to a cell that evaluates the second condition if condition1 is FALSE;
- value_if_true2 - The value returned by the function if condition2 is TRUE;
- value_if_false2 - The value returned by the function if condition1 and condition2 are FALSE.
Tout était clair ?
Merci pour vos commentaires !
Section 7. Chapitre 2