ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   COUNTIF "EVEN" numbers in a range (https://www.excelbanter.com/excel-discussion-misc-queries/157748-countif-even-numbers-range.html)

Udi14

COUNTIF "EVEN" numbers in a range
 
How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.

ExcelBanter AI

Answer: COUNTIF "EVEN" numbers in a range
 
To count the number of even numbers in a range using the COUNTIF function, you can use the following formula:
  1. =COUNTIF(B3:B10,"=EVEN(B3:B10)")

Here's a breakdown of the formula:

- COUNTIF: This is the function that counts the number of cells in a range that meet a certain criteria.
- B3:B10: This is the range of cells that you want to count.
- "=EVEN(B3:B10)": This is the criteria that you want to use to count the even numbers in the range. The EVEN function returns TRUE if the number is even, and FALSE if it's odd. The "=" sign is used to compare the result of the EVEN function to the value "TRUE".

Make sure to enclose the criteria in double quotes and use the equal sign to compare the result of the EVEN function to "TRUE". This will ensure that the COUNTIF function counts only the even numbers in the range.

Ken Johnson

COUNTIF "EVEN" numbers in a range
 
On Sep 11, 6:44 am, Udi14 wrote:
How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.


=SUMPRODUCT(--(MOD(B3:B10,2)=0))

Ken Johnson


Elkar

COUNTIF "EVEN" numbers in a range
 
Try this:

=SUMPRODUCT(--(MOD(B3:B10,2)=0))

Note that this will treat blank cells as even numbers. If you want blanks
to be excluded then try:

=SUMPRODUCT(--(MOD(B3:B10,2)=0),--(ISBLANK(B3:B10)=FALSE))

HTH,
Elkar


"Udi14" wrote:

How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.


Udi14

COUNTIF "EVEN" numbers in a range
 
Thanks but it seems complicated....if u take a simple range of numbers like
1, 4, 6, 11, 15, 18.....i should be able to countif 3 EVEN numbers
(4,6,18)...its so simple yet Excel does not allow to define "EVEN" in a
formula?

"Elkar" wrote:

Try this:

=SUMPRODUCT(--(MOD(B3:B10,2)=0))

Note that this will treat blank cells as even numbers. If you want blanks
to be excluded then try:

=SUMPRODUCT(--(MOD(B3:B10,2)=0),--(ISBLANK(B3:B10)=FALSE))

HTH,
Elkar


"Udi14" wrote:

How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.


Udi14

COUNTIF "EVEN" numbers in a range
 
It's working....thanks a lot

"Ken Johnson" wrote:

On Sep 11, 6:44 am, Udi14 wrote:
How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.


=SUMPRODUCT(--(MOD(B3:B10,2)=0))

Ken Johnson



iliace

COUNTIF "EVEN" numbers in a range
 
There is ISEVEN() function, but for some reason it doesn't work on
arrays.


On Sep 10, 5:08 pm, Udi14 wrote:
It's working....thanks a lot



"Ken Johnson" wrote:
On Sep 11, 6:44 am, Udi14 wrote:
How do I count how many EVEN numbers in a range?
I tried =COUNTIF(B3:10,"EVEN") but no success.


=SUMPRODUCT(--(MOD(B3:B10,2)=0))


Ken Johnson- Hide quoted text -


- Show quoted text -





All times are GMT +1. The time now is 11:08 PM.

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