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.
Written by Allen Wyatt (last updated June 6, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003
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:
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:
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:
This is the formula for even values:
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.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!
You can easily use the COMBIN worksheet function to determine the number of combinations that can be made from a given ...Discover More
In mathematics, the sum of a range of sequential integers, starting with 1, is known as a triangular number or Gaussian ...Discover More
A common task faced by Excel users is to determine whether items in one list are also found in a different list. There ...Discover More
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.