How can I 'CountIf' alternate cells?

J

John Blackwell

We're using large excel 2007 workbooks and I'd like to apply the CountIf
function to alternate cells in a row. The rows are D22:KC22 and contain
numeric entries (from 1 to 5).

I want to count the number of "1" entries in each alternate cell.

What's the best way of achieving this?
 
T

Tom Hutchins

Try

=SUMPRODUCT(--(MOD(COLUMN(D22:KC22),2)=0),--(D22:KC22=1))

for alternate columns with even numbers (D, F, H, etc.) For alternate
columns with odd numbers (E, G, I, etc.) use

=SUMPRODUCT(--(MOD(COLUMN(D22:KC22),2)=1),--(D22:KC22=1))

Hope this helps,

Hutch
 
J

John Blackwell

Spectacular Tom, a great result. I can't profess to actually understand the
formula but it works a treat.

Thank you,

John
 

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