Search Not Just Numbers


Tuesday, 9 August 2016

Excel Tip: Using Logic in Excel

Logic (particularly Boolean Logic) plays a huge rule in computer programming and circuitry, but is also very useful in Excel.

It is fundamental to the IF statement which in itself is such an important tool in Excel, but has many other roles.

Essentially, when we talk about logic in this context, we are talking about expressions that can either be true or false, e.g.


You can simply type the expression as a formula in a cell putting an "=" in front of it, so if you enter:


into, say, cell B1, then cell B1 will show the word TRUE if A1 is 100 and the word FALSE otherwise.

As mentioned earlier, one of the more common places to use these expressions is in an IF statement, which works as follows:

=IF(expression,value to return if expression is TRUE,value to return if expression is FALSE)



will return Yes if A1 is 100 and No if not.

Some logical functions
There are a few logical functions which extend the possibilities, in particular we will look at NOT, AND and OR.

NOT reverses the result of a logical expression.



returns TRUE, then


returns FALSE, and vice versa.

AND allows you to list multiple expressions and returns TRUE only if ALL of the expressions would individually return TRUE. Otherwise it returns FALSE.

OR works the same but returns TRUE if ANY of the expressions are TRUE.



will only return TRUE, if all three of those statements are TRUE.



will return TRUE if any of the three conditions are TRUE.

By using this type of logical expression, particularly within an IF statement, or  a Conditional Formatting condition, we can control how a spreadsheet both looks and calculates based upon the content of cells.

If you enjoyed this post, go to the top of the blog, where you can subscribe for regular updates and get two freebies "The 5 Excel features that you NEED to know" and "30 Chants for Better Charts".


  1. often these can be used to replace IF statements altogether, not only the egregious =IF(A1=100,TRUE,FALSE) [yes, it happens]
    can become:
    [allegedly it's quicker; and can avoid nesting IFs, so improving readability]

    text IF statements can be replaced by using REPT:
    =IF(A1=100,"text","") becomes


    1. Handy tips Jim. Thanks for the input.

    2. oh yeah! this approach to Excel is really similar to programming one, this is the basic to develop algorithms. I have never saw someone using this approach on Excel
      well done mate!