# Counting Odds and Evens

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Counting Odds and Evens.

Pini has a range of whole numbers (let's say C2:J2) and some of the numbers can be odd and some even. He would like a formula to count the number of odd values in the range and another to count the number of even values in the range.

There are a couple of ways to derive the desired counts, without resorting to intermediate values or macros. One way is to use an array formula, such as the following, to determine a count of odd values:

```=SUM((MOD(C2:J2,2)<>0)*1)
```

Enter the formula using Ctrl+Shift+Enter and you get the desired count. Only a small change is required for the array formula to return the count of even numbers:

```=SUM((MOD(C2:J2,2)=0)*1)
```

If you prefer to not use an array formula, you could use SUMPRODUCT to return the same count, as a regular formula. For example, here is the formula to return a count of odd values:

```=SUMPRODUCT(--(MOD(C2:J2,2)=1),--(C2:J2<>""))
```

This is the formula for even values:

```=SUMPRODUCT(--(MOD(C2:J2,2)=0),--(C2:J2<>""))
```

Another advantage of using the SUMPRODUCT approach is that it compensates for possible blank cells in your range. The earlier array formulas will always count blank cells as if they contain an even value.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7985) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Counting Odds and Evens.

Related Tips:

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

 *Name: Email: Notify me about new comments ONLY FOR THIS TIP Notify me about new comments ANYWHERE ON THIS SITE Hide my email address *Text: *What is 5+3 (To prevent automated submissions and spam.)

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

# Our Company

Sharon Parq Associates, Inc.

# Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Excel Products

Word Products

# Our Authors

Author Index

Write for Tips.Net