How to Use Boolean Values (Logical Values) in Excel

Binary code
KTSDESIGN/SCIENCE PHOTO LIBRARY / Getty Images

Boolean value, which is sometimes called a logical value, is one of several types of data used in spreadsheets in applications like Excel and Google Sheets. Named after the 19th-century mathematician George Boole, Boolean values are part of a branch of algebra known as Boolean algebra or Boolean logic.

Boolean logic is vital to all computer technology, not just spreadsheet programs, and rests on the concept that all values can be reduced to either TRUE or FALSE or since computer technology is based on the binary number system, either 1 or 0.

Note: These instructions apply to Excel versions 2019, 2016, 2013, 2010, and Excel for Office 365.

Boolean Values and Spreadsheet Logical Functions

Boolean values in spreadsheet programs are most often created using the logical group of functions such as the IF function, the AND function, and the OR function.

Screenshot of Excel showing Boolean formulas

In these functions, Boolean values are the input source for one of the function's arguments, or they can form the output or results of a function that is evaluating other data in the worksheet.

For example, the first argument of the IF function in row 4 — the logical test argument — is required to return a Boolean value as an answer. The argument must always evaluate a condition that can only ever result in a TRUE or FALSE response. As a result:

  • If the argument returns an answer of TRUE, the function performs one action. In this example, it multiplies the data in cell A2 by 25.
  • If the argument returns an answer of FALSE, the function performs a different action. In this case, it multiplies the data in cell A2 by 10.

Boolean Values and Arithmetic Functions

Unlike logical functions, most functions in Excel and Google Sheets that perform arithmetic operations such as SUM, COUNT, and AVERAGE ignore Boolean values when they are in cells included in a function's arguments.

Screenshot of Excel showing COUNT function example

For example, in the example image, the COUNT function in row 5, which only counts cells containing numbers, ignores the TRUE and FALSE Boolean values located in cells A3, A4, and A5 and returns an answer of 0.

Converting TRUE and FALSE to 1 and 0

To have Boolean values included in the calculations of arithmetic functions, you must first convert them to numeric values before passing them to the function. Two ways of accomplishing this step are to:

  • Multiply the Boolean values by one (as shown by the formulas in rows 7 and 8 of the example, which multiply the values TRUE and FALSE in cells A3 and A4 by one).
  • Add a zero to each Boolean value (as shown by the formula in row 9 of the example, which adds 0 to the value TRUE in cell A5).

These operations have the effect of converting the value TRUE in cells A3 and A5 to 1 and the value FALSE in cell A4 to 0. As a result, the COUNT function in row 10, which totals number data in cells A7 to A9, returns a result of 3 rather than 0.

Screenshot of Excel showing conversion of BOOLEAN values

Boolean Values and Excel Formulas

Unlike arithmetic functions, formulas in Excel and Google Sheets that carry out arithmetic operations such as addition and subtraction are happy to read Boolean values as numbers without the need for conversion. Such formulas automatically set TRUE equal to 1 and FALSE equal to 0.

As a result, the addition formula in row 6 in the example image,

= A3 + A4 + A5

reads the data in the three cells as:

= 1 + 0 + 1

and returns an answer of 2 accordingly.