# How to get the Count of odd numbers? How to get the Count of even numbers?

In this article, we will learn to How to Count Odd / Even Numbers In Excel.

Scenario:

Working with numbers data, Sometimes we need to get the count of odd numbers or count of even numbers in the list. Like getting the count of odd vehicle numbers or count of even vehicle numbers in the parking list. For this we can use the basic sense of odd and even numbers i.e odd numbers leaves a remainder 1 when divide by 2 whereas even numbers leave 0 as remainder when divide by 2.

Functions used and formula Syntax:

The following function will be in use. So get to know a little about, before using it.

We will construct a formula out of it. Firstly, the MOD function takes the remainder of value by 2 ( divisibility factor ) and. SUMPRODUCT function returns the sum of corresponding values to TRUE values (as 1) and ignore values corresponding to FALSE values (as 0) in the array.

Generic formula:

 =SUMPRODUCT(--(MOD(range,2)=1))

range : range of values to check for

Example:

Let's test this formula via running it on the example shown below. Here we need to find the count of numbers listed in range. For that we have a list of numbers and we will get the Count of odd numbers in the list using the formula. Now we will use the formula below to get the Count of values in the table satisfying the mentioned criteria.

Formula:

 = SUMPRODUCT(--(MOD(C3:C17,2)=1),C3:C17)

Explanation:

• MOD Function matches remainder with xero value for each value in range.
• Negation sign changes True to False values and False to True values.
• MOD function takes single input and single output (remainder) but we want an array of values for the input range. Negation (--) character helps it do it.
• SUMPRODUCT function returns the Count of corresponding values to TRUE values (as 1) and ignore values corresponding to FALSE values (as 0) in the returned array.

Here the arrays to the function are given as array reference. Use double (--) manually Press Enter to get the result.

As you can see in the above snapshot the Count comes out to be 8. This is the Count to the corresponding odd numbers in the range wherever it lays. Now to see below to find the Count even numbers in range.

Count even numbers :

How to get the Count of even numbers in excel. We will use the same formula we used to calculate for the odd numbers. Just use the =0 instead for = 1. As the remainder must be 0 for the even numbers when divided by 2.

Use the formula:

 =SUMPRODUCT(--(MOD(C3:C17,2)=0),C3:C17)

=0 : even numbers

range : range of values to check for

As you can see in the above snapshot the Count of odd numbers on the left and Count of numbers on the right side under the Count column.

Alternate long method using the ISODD function & ISEVEN function

For this excel has also been given as two built-in functions to directly check the number in the cell is odd or even, ISODD function & ISEVEN function. But the problem is these functions can only be used for the one cell. So if you just have to count the odd numbers or even numbers in excel using these functions follow the steps.

1. Make a column next to it and use =ISODD(cell) for the first number.
2. Then copy the formula using Ctrl + D along the numbers to get a range of values having TRUE and FALSE values. True corresponds to odd numbers and false to even numbers.
3. Apply Filter option on the array using Sort & Filter option or keyboard shortcut Ctrl + Shift + L.
4. Filter the TRUE values for the count of odd numbers and filter the FALSE values for the count of even numbers in the array. See the below gif to understand.

If using the ISEVEN function. Then TRUE values are even numbers and FALSE values are odd numbers

Using index column, calculate the sum of odd number rows and even number rows.

Sum of odd number rows:

We can use the different ranges for the criteria in MOD function and SUM from other range. For this we will have another index list which will be our criteria. Use the below formula to get the sum of numbers having odd number rows.

Use the formula:

 =SUMPRODUCT(--(MOD(B3:B17,2)=1),C3:C17)

B3:B17 : range of values to check for.

C3:C17 : range to sum values.

As you can see in the above snapshot the addition comes out to be 52783. This is the sum to the corresponding odd row numbers in the range wherever it lies. Now to see below to find the sum having even row numbers.

Sum of even row numbers :

How to get the sum of even row numbers in excel. We will use the same formula we used to calculate for the odd row numbers. Just use the =0 instead for = 1. As the remainder must be 0 for the even numbers when divided by 2.

Use the formula:

 =SUMPRODUCT(--(MOD(B3:B17,2)=0),C3:C17)

B3:B17 : range of values to check for.

C3:C17 : range to sum values.

As you can see in the above snapshot the sum of odd number rows on the left and sum of even number rows on the right side under the sum column.

Here are all the observational notes regarding using the formula.

Notes:

1. The formula only works with numbers.
2. The two ranges provided in the formula must have the same number of rows or the formula returns error.
3. Negation (--) char changes values, TRUEs or 1s to FALSEs or 0s and FALSEs or 0s to TRUEs or 1s .
4. MOD function takes single input and single output (remainder) but we want an array of values for the input range. Negation (--) character helps it do it.
5. SUMPRODUCT function returns the sum after taking individual products in the corresponding array.
6. Operators like equals to ( = ), less than equal to ( <= ), greater than ( > ) or not equals to ( <> ) can be performed within a formula applied, with numbers only.

Hope this article about How to get the Count of odd numbers or How to get the Count of even numbers? in Excel is explanatory. Find more articles on Counting formulas here. If you liked our blogs, share it with your fristarts on Facebook. And also you can follow us on Twitter and Facebook. We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com

Related Articles

Find the last row of data with numbers in Excel : In a range of text values find the last of data in excel.

How to use the SUMPRODUCT function in Excel: Returns the SUM after multiplication of values in multiple arrays in excel.

COUNTIFS with Dynamic Criteria Range : Count cells depstartent on other cell values in Excel.

COUNTIFS Two Criteria Match : Count cells matching two different criteria on list in excel.

COUNTIFS With OR For Multiple Criteria : Count cells having multiple criteria match using the OR function.

The COUNTIFS Function in Excel : Count cells dependent on other cell values.

How to Use Countif in VBA in Microsoft Excel : Count cells using Visual Basic for Applications code.

How to use wildcards in excel : Count cells matching phrases using the wildcards in excel

Popular Articles

50 Excel Shortcut to Increase Your Productivity : Get faster at your task. These 50 shortcuts will make you work even faster on Excel.

How to use the VLOOKUP Function in Excel : This is one of the most used and popular functions of excel that is used to lookup value from different ranges and sheets.

How to use the COUNTIF function in Excel : Count values with conditions using this amazing function. You don't need to filter your data to count specific values. Countif function is essential to prepare your dashboard.

How to Use SUMIF Function in Excel : This is another dashboard essential function. This helps you sum up values on specific conditions.

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.