Former Lifewire writer Ted French is a Microsoft Certified Professional who teaches and writes about spreadsheets and spreadsheet programs.
Updated on January 1, 2021This article explains how to use the AND function and the OR function 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:
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.
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:
=AND (logical_expression1, logical_expression2, . )
The syntax for the OR function is:
=OR (logical_expression1, logical_expression2, logical_expression3, . )
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.
Google Sheets does not use dialog boxes to enter a function's arguments the way Excel does. Instead, it has an auto-suggest box that pops up as the name of the function is typed into a cell.
When the function AND appears in the box, click on the name with the mouse pointer.
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.
Type < 50after the cell reference.
Type a comma after the cell reference to act as a separator between the function's arguments.
Click on cell A3 in the worksheet to enter this cell reference as the logical_expression2 argument.
Type <> 75 after the cell reference, followed by another comma.
Click on cell A4 in the worksheet to enter the third cell reference and type >=100.
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.