Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • How to Create Thermometer Chart in Excel
  • How to sum a total in multiple Excel tables
  • How to count table rows in Excel
  • Calculate Conditional Percentile ‘IF’ in table in Excel
  • Excel Frequency Function Example

References

  • VLOOKUP function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel COLUMN Function
  • Lookup entire row in Excel
  • How to get last column number in range in Excel
  • Basic INDEX MATCH approximate in Excel

Data Validations

  • Excel Data validation date in specific year
  • Excel Data validation must begin with
  • Excel Data validation must not contain
  • Excel Data validation specific characters only
  • Excel Data validation exists in list

Count cells that contain odd numbers in Excel

by

This tutorial shows how to Count cells that contain odd numbers in Excel using the example below;

Formula

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

Explanation

To count cells that contain only odd numbers, you can use a formula based on the SUMPRODUCT function together with the MOD function.

In the example, the formula in cell E6 is:

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

This formula returns 4 since there are 4 odd numbers in the range B6:B11 .

How this formula works

The SUMPRODUCT function works directly with arrays.

One thing you can do quite easily with SUMPRODUCT is perform a test on an array using one or more criteria, then count the results.

In this case, we are running a test for an odd number, which uses the MOD function:

MOD(range,2)=1

MOD returns a remainder after division. In this case, the divisor is 2, so MOD will return a remainder of 1 for any odd integer, and a remainder of zero for even numbers.

Inside SUMPRODUCT, this test is run on every cell in B6:B11, the result is an array of TRUE / FALSE values:

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

After we coerce the TRUE/FALSE values to numbers using the double negative, we have:

{0;1;1;1;0;1}

SUMPRODUCT then simply sums these numbers and returns 4.

Post navigation

Previous Post:

How to use Excel CHOOSE Function

Next Post:

Customize Ribbon In Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to use Excel XOR Function
  • How to use Excel AND Function
  • IFERROR function: Description, Usage, Syntax, Examples and Explanation
  • How to use Excel OR Function
  • IFNA function: Description, Usage, Syntax, Examples and Explanation

Date Time

  • How to get same date next month or previous month in Excel
  • Display the current date and time in Excel
  • How to calculate Next working/business day in Excel
  • Count birthdays by month in Excel
  • EOMONTH function: Description, Usage, Syntax, Examples and Explanation

Grouping

  • Group numbers at uneven intervals in Excel
  • Map inputs to arbitrary values in Excel
  • How to randomly assign data to groups in Excel
  • Group times into unequal buckets in Excel
  • How to randomly assign people to groups in Excel

General

  • How to get Excel workbook path only
  • Find Most Frequently Occurring Word in Excel Worksheet
  • How to generate random number weighted probability in Excel
  • 44 Practical Excel IF function Examples
  • How to get original price from percentage discount in Excel
© 2023 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning