formula for counting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a formula to count if A:A=1 and B:B<20
The value should be 2
A B
1 1 12
2 2 75
3 1 86
4 1 16
 
One way:

=SUMPRODUCT(--(A1:A100=1)*(B1:B100<20))

This requires that you specify a range, not the entire column.

Regards,
Paul
 
=SUMPRODUCT(--(A1:A100=1),--(B1:B100<20))

Note that SUMPRODUCT doesn't work with complete columns, you have to specify
a range.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
I think

=SUMPRODUCT((A1:A100=1)*(B1:B100<20))

is also fine - without coercing.

Epinn

One way:

=SUMPRODUCT(--(A1:A100=1)*(B1:B100<20))

This requires that you specify a range, not the entire column.

Regards,
Paul
 
Wrong term. I should be more specific and used the term "double unary." * (multiplication sign) is also coercing, right? One of these days, I'll get it right.

Epinn


is also fine - without coercing.

What makes you say without coercing?
 
Coercing is forcing TRUE/FALSE to 1/0. All operators do that.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Wrong term. I should be more specific and used the term "double unary." *
(multiplication sign) is also coercing, right? One of these days, I'll get
it right.

Epinn


is also fine - without coercing.

What makes you say without coercing?
 
Yes, I know the first part. I have to think about the second. *All* operators, eh? I am only familiar with + - * /

Epinn

Coercing is forcing TRUE/FALSE to 1/0. All operators do that.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Wrong term. I should be more specific and used the term "double unary." *
(multiplication sign) is also coercing, right? One of these days, I'll get
it right.

Epinn


is also fine - without coercing.

What makes you say without coercing?
 
N, ^

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Yes, I know the first part. I have to think about the second. *All*
operators, eh? I am only familiar with + - * /

Epinn

Coercing is forcing TRUE/FALSE to 1/0. All operators do that.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

Wrong term. I should be more specific and used the term "double unary." *
(multiplication sign) is also coercing, right? One of these days, I'll get
it right.

Epinn


is also fine - without coercing.

What makes you say without coercing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top