# Thread: counting unmet criteria (2000-2003)

1. ## counting unmet criteria (2000-2003)

I would search for this answer, but I'm not sure what search terms to use!

Is there a straightforward way to total the number of times a value in one column is less than the corresponding value of another?

I'm attaching a dummy spreadsheet where I highlighted the cells that I would want counted. Any ideas?

2. ## Re: counting unmet criteria (2000-2003)

Does this formula do what you want?
<code>
=SUMPRODUCT(--(B2:C8<A2:A8))</code>

3. ## Re: counting unmet criteria (2000-2003)

Yes! Perfectly. So now I'm curious: how does it work? What does the "--" do?

4. ## Re: counting unmet criteria (2000-2003)

The result of B2:C8<A2:A8 is an array of TRUE/FALSE values.
In Excel, TRUE corresponds to 1 and FALSE to 0, but you can't use them like that directly. The first - before (B2:C8<A2:A8) forces the TRUE values to become the number -1 and the FALSE values to 0. The second - converts the -1's to 1.

You could also have used SUMPRODUCT(1*(B2:C8<A2:A8)). Here, the TRUE/FALSE values are converted to numbers by multiplying them with 1.

5. ## Re: counting unmet criteria (2000-2003)

Excellent - thank you so much for the explanation!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•