How to Use the AND and OR Logical Functions in Google Sheets

Test multiple conditions to return TRUE or FALSE results

What to Know

  • 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, ... )

This article explains how to use the AND function and the OR function in Google Sheets.

spreadsheet business finance data and marketing target strategy concept in flat design vector illustration
200degrees/ Getty Images

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:

=AND(A2<50,A3<>75,A4>=100)=OR(A2<50,A3<>75,A4>=100)

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:

=AND (logical_expression1, logical_expression2, ...)

The syntax for the OR function is:

=OR (logical_expression1, logical_expression2, logical_expression3, ... )
  • 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.

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.

  1. Click on cell A2 to make it the active cell; this is where the AND function is entered and where its result is displayed.

  2. Type the equal sign (=) followed by the function AND.

  3. As you type, the auto-suggest box appears with the names of functions that begin with the letter A.

  4. When the function AND appears in the box, click on the name with the mouse pointer.

    Screenshot of the AND function in Google Sheets

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.

  1. Click on a cell in the worksheet to enter this cell reference as the logical_expression1 argument. Using the main image as an example, you would select cell A2.

  2. Type < 50 after the cell reference.

    An example of the AND function in Google Sheets
  3. Type a comma after the cell reference to act as a separator between the function's arguments.

    Example of how to use the AND function in Google Sheets
  4. Click on cell A3 in the worksheet to enter this cell reference as the logical_expression2 argument.

    Example of the AND function in Google Sheets
  5. Type <> 75 after the cell reference, followed by another comma.

    Example of the AND function in Google Sheets
  6. Click on cell A4 in the worksheet to enter the third cell reference and type >=100.

    Example of the AND function in Google Sheets
  7. Press the Enter to complete the function.

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.

Was this page helpful?