From the Not Just Numbers blog:
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”.