ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   count even-numbered values in a range (https://www.excelbanter.com/excel-discussion-misc-queries/152563-count-even-numbered-values-range.html)

Dave F[_2_]

count even-numbered values in a range
 
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.


Dave F[_2_]

count even-numbered values in a range
 
I seem to have answered this: =SUM(--MOD(A1:A100,2)) entered as an
array gives the correct answer.

Dave

On Aug 1, 10:45 am, Dave F wrote:
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.




David Biddulph[_2_]

count even-numbered values in a range
 
=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?
--
David Biddulph

"Dave F" wrote in message
ups.com...
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.




Pete_UK

count even-numbered values in a range
 
Try this array* formula:

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

* Commit with CTRL-SHIFT-ENTER

Hope this helps.

Pete

On Aug 1, 3:45 pm, Dave F wrote:
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.




Dave F[_2_]

count even-numbered values in a range
 
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.

On Aug 1, 11:06 am, "David Biddulph" <groups [at] biddulph.org.uk
wrote:
=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?
--
David Biddulph

"Dave F" wrote in message

ups.com...



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.- Hide quoted text -


- Show quoted text -




John Bundy

count even-numbered values in a range
 
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.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Dave F" wrote:

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.




All times are GMT +1. The time now is 04:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com