Microsoft Office Tutorials and References

In Depth Information

**Let’s Be Logical**

Figure 14-4:

Being

selective

with

summing.

Cell C22 calculates the full sum with this formula:

=SUM(C2:C20)

The total is $3,122.

On the other hand, the formula in cell C24 is:

{=SUM(IF(NOT(A2:A20=”June”),C2:C20,””))}

This says to sum values in the range C2:C20 only for where the associated

month in column A is not June.

Note that this formula is an array formula. When entered, the entry was

completed with Ctrl+Shift+Enter instead of just plain Enter. See Chapter 3 for more

information on array formulas.

AND and OR

Next are the AND and OR functions. AND and OR both return a single logical

answer — either true or false — based on the values of two or more logical

tests (such as the way IF works):

✓
The AND function returns true if
all
the tests are true. Otherwise, false is

returned.

✓
The OR function returns true if
any
one or more of the tests is true.

Otherwise, false is returned.