count even-numbered values in a range

D

Dave F

I have a range of randomly generated, positive whole numbers and need
to count the even values.

I assumed something like =SUM(--(ISEVEN(A1:A100))) entered as an array
formula would work, similar to entering =SUM(--(ISBLANK(A1:A100))) as
an array formula counts the blank cells within the referenced range.

But using ISEVEN in this manner returns #VALUE!

Is there another way to do this?

Thanks.
 
D

Dave F

I seem to have answered this: =SUM(--MOD(A1:A100,2)) entered as an
array gives the correct answer.

Dave
 
D

David Biddulph

=SUMPRODUCT(--(MOD(A1:A100,2)=0)) will work
or
=SUM(--(MOD(A1:A100,2)=0)) as an array formula

Are you sure that =SUM(--(ISBLANK(A1:A100))) works?
 
P

Pete_UK

Try this array* formula:

=SUM(IF(MOD(A1:A100,2)=0,A1:A100))

* Commit with CTRL-SHIFT-ENTER

Hope this helps.

Pete
 
D

Dave F

Every time I've used =SUM(--(ISBLANK(A1:A100))) it has worked.

I solved this particular problem with: =100-(SUM(--MOD(M2:M101,2)))
entered as an array formula.
 
G

Guest

Hard to tell without seeing your data, but =MOD(A1,2) tells whether a number
is evenly divisible. If it returns a 0 it is even.
 

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