Google Sheets IF AND | Google Sheets AND Operator | IF AND Function

Поделиться
HTML-код
  • Опубликовано: 17 июл 2019
  • Use the Google Sheets IF and AND functions to test more than one condition. If it is true, assign a value. If it is false, assign another value. You have to nest the AND function inside the IF function to evaluate multiple conditions. Note that the Google Sheets IF function by itself allows you to test only one logical expression.
    By combining the Google Sheets IF and AND functions, you will be able to test more than one condition. Another alternative to the Google Sheets AND operator to test multiple conditions is the IFS function.
    If, for some reason, you do not want to use IFS, then IF and AND functions in a Google spreadsheet should do the job.
    Let's look at the format of the IF function first:
    =IF(logical_expression, value_if_true, value_if_false)
    Here is an example of the IF function. Assume that the Google Sheets IF function is typed in cell C2:
    =IF(b2=0, "order", "don't order")
    What will be the data in cell C2 after this function is evaluated?. If the value in cell b2 is zero, Google Sheets displays the text "order" in cell C2. Otherwise, this program will display the text "don't order".
    Say you want to check if a2 is zero and b2 is zero. You cannot use the Google Sheets IF by itself. The Google Sheets IF AND is a solution. Nest the AND function inside the IF function to test two or more conditions.
    Now, we will take a look at the format of the AND function:
    =AND(logical_expression1, logical_expression2,...logical_expression)
    The AND function returns true, only if all of the logical expressions are true. This function returns false, even if any one of the logical expression is false.
    Here is an example of the function that uses the Google Sheets AND operator, Again, assume this function is typed in cell C2:
    =IF(AND(a2=0, b2=0), "order", "don't order")
    When one or more functions are nested inside another function, the inner most function in the nest will be first evaluated. In this case, of course, only one function, which is AND, is nested
    inside Google Sheets IF, and it will be first checked.
    The AND function will return true, if both a2 and b2 each have a value of 0. In true, the data in cell C2 will be the text "order". If either a2 or b2 is not equal to zero, then C2 will have the text "don't order".
    To recap, the Google Sheets IF function allows you to test only one logical expression. You can, however, nest the function that uses the AND operator inside IF to test multiple logical expressions. Then, assign one value to a Google spreadsheet cell, if all of the conditions inside the AND function are true. Assign another value to the cell, if either of the logical expressions inside the AND function is false.
    Do checkout this video, which illustrates the Google Sheets IF AND with an example.

Комментарии •