# How To Count All Even Numbers In A Range

## Example

{=SUM(1*(MOD(B3:B10,2)=0))}

## Generic Formula

{=SUM(1*(MOD(Range,2)=0))}

Note: This is an array formula. Do not type out the {} brackets. Hold Ctrl + Shift then press Enter while in Edit Mode to create an array formula.

Range – This is the range of values which you would like to count all even numbers from.

## What It Does

This formula will count all the even numbers from a given range of values. An even number is defined as any number that has a remainder of 0 when divided by 2.

## How It Works

The MOD function returns the remainder of a number on division by another number. For example MOD(7,2) will return 1 since the remainder of 7 divided by 2 is 1. We use the MOD function to test if a number is even. A number will be even if and only if the remainder on division by 2 equals 0. In other words, N is even if and only if MOD(N,2)=0.

MOD(Range,2)=0 will create an array of Boolean values where TRUE will mean the number is even and FALSE will mean the number is not even. We then convert these TRUE and FALSE values to 1 and 0 values by multiplying the array by 1. This will give us the count of the number of even numbers in the range.

In our example MOD({1.36;-2;2;9;10;7;1.33;8},2)=0 will result in the following Boolean array.

{FALSE;TRUE;TRUE;FALSE;TRUE;FALSE;FALSE;TRUE}

When we multiply this by 1 we get {0;1;1;0;1;0;0;1}. Then SUM({0;1;1;0;1;0;0;1}) results in 4 which is the count of even numbers in our range of values.

## John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

## Related Articles

#### How To Conditionally Concatenate A Range

This formula will conditionally concatenate a range based on a criteria in another range.

#### How To Solve a Quadratic Equation

These formulas will give the solutions to a quadratic equation.

#### How To Select A Random Item From A List

This formula will return a random selection from a given list with each item in the list having an equal probability of being selected.