countif, sumproduct

M

mg

table:
1.5.2006 blue
2.5.2006 green
30.4.2005 green
21.5.2006 yellow
21.6.2006 blue

how can I count all the green guys with the datum after 1.5.2005?
countif will not probably work...
 
B

Bernard Liengme

I will assume the first column are dates
With dates in column A and colours in B
=SUMPRODUCT(--(A1:A5>DATE(2006,5,1)),--(B1:B5="green"))
best wishes
 
M

mg

thanx a lot, that's exactly what I have been looking for.
You've helped me a lot.

Bernard Liengme píše:
 
G

giantwolf

Hi,

Just out of interest more than anything but what is the signifcance of
the "--" that appears before each argument as opposed to "*", that
Excel Help puts between the two arguments?

Cheers,
 
M

mg

what if i need to use a range in the date f.e. from 1.4.2005 to 2.5.2005?

Bernard Liengme píše:
 
G

Guest

Hi

The -- coerces a TRUE result into a 1, and a FALSE result into a 0. This can
then be used to calculate with.
If you type =FALSE in a cell, it will give the result of FALSE. If you type
=--FALSE into a cell, you will get 0 as the result. Other ways of doing the
same job are to use a * to multiply or even a +0. It's just a way of making
Excel treat logical results as numbers.

Hope this helps.
 
G

Guest

Hi

Try something like this:
=SUMPRODUCT(--(A1:A5>=DATE(2006,4,1))*(A1:A5<=DATE(2006,5,2)),--(B1:B5="green"))
 
B

Bob Phillips

or

=SUMPRODUCT(--(A1:A5>=--"2006-04-01"),-(A1:A5<=--"2006-05-02"),--(B1:B5="gre
en"))


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Top