Referencing previous column in COUNTIF

  • Thread starter Thread starter alistair_henderson
  • Start date Start date
A

alistair_henderson

Evening All,

I am a novice Excel user, so please excuse the probably very basic
question. I have a spreadsheet with two columns, e.g.

A E
D E
F L
A E
G E

I am trying to get some totals for column 2 based on the value, so I
used COUNTIF(D4:D34, "E"). This is great, but I only want to count
column 2 if the corresponding cell in column 1 is "A" (or not "A" for
my other total). I think I want to somehow use INDIRECT as well, but
can't quite figure out how! The total I am looking for in the example
would be 2 (col2="E" and col1="A").

Thanks for any hints/advice.

Cheers,
Al.
 
=SUMPRODUCT(--(A1:A10="A"),--(B1:B10-"E"))

--

HTH

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

=SUMPRODUCT(--(C4:C34="A"),--(D4:D34="E"))

Hope this helps!
 
=SUMPRODUCT(--(A2:A100="A"),--(B2:B100="E"))

will count "E" in B where A is "A"
 
Thanks everyone for all your help there - superb! Just one question,
what does '--(C4:C34="A")' do - is it some method of creating an array
from the cells?

Thanks again,
Al.
 

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