Boolean algebra is a mathematical system that represents logical expressions and relationships using only two values: TRUE and FALSE.  Boolean logic refers to the principles that support Boolean algebra, including logical operations like AND, OR, and NOT and rules that govern the manipulation of logical expressions in Boolean algebra.

In the context of Excel, Boolean logic refers to a technique of building formulas to take advantage of the fact that TRUE can be represented by the number 1, and FALSE can be represented by the number 0.  In fact any math operation in Excel will coerce TRUE and FALSE values into 1's and 0's automatically, as seen in the simple examples below:

``````=TRUE+0=1
=TRUE*1=1
=FALSE+0=0
=FALSE*1=0``````

Boolean logic can be used to simply formulas and eliminate the branching seen in nested IF formulas. In the example shown, the formula in cell E5 checks that group is "red" and score is > 80 like this:

``````=(C5>80)*(D5="red")
=(TRUE)*(TRUE)
=1
``````

This is functionally equivalent to the formula below based on the IF function and the AND function:

``````=IF(AND(C5>80,D5="red"),1,0)
``````

### Boolean logic in array operations

Boolean logic often shows up inside other formulas and functions to perform array operations. The SUMPRODUCT function is a good example. To count cells in A1:A10 that are equal to "red" with SUMPRODUCT, you can use a formula like this:

``````=SUMPRODUCT(--(A1:A10="red"))
``````

The double negative coerces the TRUE and FALSE values that result from the expression A1:A10="red" to 1s and 0s, and SUMPRODUCT then returns the sum of these numbers, which corresponds to the count of cells that contain "red". To sum numbers in B1:B10 when the value in A1:A10 is "red", you can use a formula like this:

``````=SUMPRODUCT(--(A1:A10="red")*B1:B10)
``````

SUMPRODUCT has special features that make it especially suitable for this kind of formula in older versions of Excel. In the latest version of Excel, you can also use the SUM function like this:

``````=SUM(--(A1:A10="red")*B1:B10)
``````

For another practical example of Boolean logic, see INDEX and MATCH with multiple criteria.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://exceljet.net/glossary/boolean-logic", "fetch_time": 1726862440000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2024-38/segments/1725701423570.98/warc/CC-MAIN-20240920190822-20240920220822-00530.warc.gz", "warc_record_offset": 217467658, "warc_record_length": 9626, "token_count": 549, "char_count": 2161, "score": 4.4375, "int_score": 4, "crawl": "CC-MAIN-2024-38", "snapshot_type": "latest", "language": "en", "language_score": 0.8703100085258484, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00043-of-00064.parquet"}