How the Logical Functions Work in Google Sheets
The AND and OR logical functions are two of the better-known ones in Google Sheets. They test whether or not the output from two or more target cells meets the conditions you specify. They only return one of two results (or Boolean values) in the cell where they’re used, either TRUE or FALSE. The AND function tests formulas in multiple cells and returns a TRUE response only if all of them are true. Otherwise, it returns FALSE as a value. Meanwhile, the OR function returns a TRUE response if any of the tested formulas are true. It gives a FALSE value only if all the formulas are not true. These TRUE or FALSE answers can be displayed as-is in the cells where the functions are located. The functions can be combined with other Google Spreadsheet functions, such as the IF function, to display various results or carry out several calculations. In this article’s images, cells B2 and B3 contain an AND and OR function, respectively. Both use a number of comparison operators to test a variety of conditions for the data in cells A2, A3, and A4 of the worksheet. The two functions are: They test the following conditions:
If the data in cell A2 is less than 50 (< is the symbol for less than)If the data in cell A3 is not equal to 75 (<> is the symbol for not equal to)If the data in cell A4 is greater than or equal to 100 (>= is the symbol for greater than or equal to)
For the AND function in cell B2, the data in cells A2 to A4 must match all three of the conditions above for the function to return a TRUE response. As it stands, the first two conditions are met, but since the value in cell A4 is not greater than or equal to 100, the output for the AND function is FALSE. In the case of the OR function in cell B3, only one of the conditions above needs to be met by the data in cells A2, A3, or A4 for the function to return a TRUE response. In this example, the data in cells A2 and A3 both meet the required condition, so the output for the OR function is TRUE.
Syntax and Arguments for AND/OR Functions
A function’s syntax refers to the function’s layout and includes the function’s name, brackets, and arguments. The syntax for the AND function is: The syntax for the OR function is:
logical_expression1 [Required] refers to the condition being tested. The form of the condition is normally the cell reference of the data being checked followed by the condition itself, such as A2 < 50. logical_expression2, logical_expression3, … [Optional] are additional conditions that can be tested.
Entering the AND or OR Function
The following steps cover how to enter the AND function, like the one located in cell B2 in the main image. The same steps can be used for entering the OR function located in cell B3.
How to Enter the Function Arguments
The arguments for the AND function are entered after the open parenthesis. As in Excel, a comma is inserted between the function’s arguments to act as a separator. If you’ve been following our example, the value FALSE should appear in cell B2 because the data in cell A4 does not meet the condition of being greater than or equal to 100. To enter the OR function, repeat the above steps using =OR instead of =AND.