Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel True and False: How to Use Boolean Logic

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To get a TRUE or FALSE result in Excel, you use a logical comparison operator (such as =, <>, >, or <) to compare two values. For example, typing =10>5 into a cell will immediately return TRUE because the statement is mathematically correct. These are known as Boolean values, and they serve as the foundation for almost every advanced function in Excel, including IF statements, SUMIFS, and conditional formatting.

What You'll Need

  • A computer with Microsoft Excel installed (all versions) or a web browser using Excel for the Web.
  • A dataset or a few cells containing numbers, dates, or text to test against.
  • A basic understanding of how to enter a formula starting with the equals sign (=).

Step-by-Step

  1. Enter a Simple Comparison: Select any empty cell. Type = followed by a comparison. For example, if you want to check if cell A1 is equal to 100, type =A1=100. Press Enter. If A1 contains 100, the cell will display TRUE; otherwise, it will display FALSE.
  2. Use Logical Operators: Depending on what you are testing, use the correct operator.
    • = (Equal to)
    • <> (Not equal to)
    • > (Greater than)
    • < (Less than)
    • >= (Greater than or equal to)
    • <= (Less than or equal to)
  3. Compare Text Values: Boolean logic isn't just for numbers. You can check if a cell matches a specific word. Type =B1="Completed". Note that text must always be enclosed in double quotation marks. If B1 says Completed, the result is TRUE.
  4. Combine Logic with the AND Function: When you need multiple conditions to be TRUE at the same time, use the AND function. Type =AND(A1>10, B1<20). This formula returns TRUE only if both conditions are met. If either (or both) are false, the result is FALSE.
  5. Combine Logic with the OR Function: Use the OR function when you only need one of several conditions to be true. Type =OR(A1="Yes", B1="Yes"). This returns TRUE if either cell contains "Yes". It only returns FALSE if neither cell contains the word.
  6. Integrate into an IF Statement: The most common use for TRUE/FALSE is inside an IF function to trigger a specific action. The syntax is =IF(logical_test, value_if_true, value_if_false). For example, =IF(A1>=60, "Pass", "Fail"). Here, Excel first calculates if A1 is 60 or more (TRUE or FALSE), and then displays "Pass" for TRUE and "Fail" for FALSE.
  7. Apply to Conditional Formatting: You can use TRUE/FALSE logic to change cell colors. Go to the Home tab, select Conditional Formatting > New Rule > Use a formula to determine which cells to format. Enter a logical formula like =A1<0. Whenever that formula evaluates to TRUE, Excel will apply your chosen formatting (e.g., turning the cell red).

Common Mistakes

One of the most frequent errors is wrapping the TRUE or FALSE keywords in quotation marks. In Excel, TRUE and FALSE are reserved logical values. If you type ="TRUE", Excel treats it as a piece of text (a string), not a logical value. This can break formulas like SUMPRODUCT or IF that expect a Boolean input.

Another common mistake is forgetting the double quotes around text strings during comparison. Writing =A1=Completed will result in a #NAME? error because Excel thinks "Completed" is the name of a defined range or a function. It must be =A1="Completed".

Users also often confuse the "Not Equal To" operator. Many try to use != (which is common in coding languages like C# or Python), but Excel only recognizes <>. Using the wrong symbol will result in a formula error.

Finally, mixing data types can lead to unexpected FALSE results. If a cell looks like a number but is actually formatted as text, a comparison like =A1=10 might return FALSE even if the cell visually displays 10. This happens because the text "10" is not the same as the numeric value 10.

Tips

To quickly convert a range of TRUE/FALSE values into 1s and 0s (which is useful for mathematical calculations), use the double unary operator (double minus). For example, if cell A1 is TRUE, =--A1 will return 1. If A1 is FALSE, it returns 0. This is a powerful trick for advanced data analysis and array formulas.

When dealing with large datasets, use the NOT function to reverse a logic result. Instead of writing a complex "not equal to" string, you can wrap a simple comparison in NOT, such as =NOT(A1="Closed"). This returns TRUE for every cell that is NOT closed.

For those managing dates, remember that Excel treats dates as numbers. To check if a date in A1 is before today, use =A1. This will return TRUE if the date has already passed.

If you want to check if a cell is empty, do not use =A1="" exclusively if you want to be precise. While it works for empty strings, using =ISBLANK(A1) is the official way to return a TRUE/FALSE value based on whether a cell is truly empty.

Troubleshooting

If your formula is returning #VALUE!, check that you are not trying to perform a logical comparison on incompatible data types, such as comparing a date to a word. Ensure both sides of your operator are of a similar nature (number to number, text to text).

If your IF statement always returns the "FALSE" result even when you think it should be "TRUE", check for hidden spaces in your text. A cell containing "Completed " (with a trailing space) is NOT equal to "Completed". You can fix this by wrapping your cell reference in the TRIM function: =IF(TRIM(A1)="Completed", "Yes", "No").

If you see a #NAME? error, double-check your spelling of functions (like AND, OR, IF) and ensure all text strings are enclosed in double quotes. This error almost always means Excel doesn't recognize a word you've typed.

If the cell simply displays the formula (e.g., it shows =A1=10) instead of the result TRUE or FALSE, the cell is likely formatted as "Text". Change the cell format to "General" via the Home tab, then click into the formula bar and press Enter again to force the calculation.

Frequently Asked Questions

Can I change TRUE/FALSE to say Yes/No?

Yes, but you cannot change the Boolean value itself. You must use an IF statement to translate it. For example, =IF(A1=TRUE, "Yes", "No") will display Yes or No based on the logical result.

Is TRUE the same as 1 in Excel?

Mathematically, yes. In many calculations, Excel treats TRUE as 1 and FALSE as 0. However, they are different data types. To force a TRUE value to become the number 1, you can multiply it by 1 or use the -- operator.

How do I check for multiple conditions at once?

Use the AND function for "all must be true" and the OR function for "at least one must be true". You can nest these inside each other for complex logic, such as =AND(A1>10, OR(B1="Red", B1="Blue")).

Why does my TRUE/FALSE result center itself in the cell?

Excel automatically centers Boolean values (TRUE/FALSE) because it recognizes them as a special data type, unlike text (which aligns left) or numbers (which align right). This is a built-in behavior to help users distinguish logic from data.

Can I use TRUE/FALSE in a Pivot Table?

Yes, but Pivot Tables often treat them as text. To make them more useful in a Pivot Table, it is better to create a helper column using =-- (LogicalFormula) to convert them to 1s and 0s, allowing you to sum or average the results.