Site icon ExcelNotes

How to Sum Odd Numbers

Odd numbers are not divisible by two (e.g., one, three, five, etc.). When an odd number is divided by two, the remainder is one. You can use the MOD and SUMPRODUCT functions to count the number of odd numbers.

Example: You are working with a worksheet with the product in column A, the amount in column B, and the profit/loss in column C.

Question : What is the Sum of the Odd Numbers in Column C?

=SUMPRODUCT(–(MOD(C2:C10,2)=1),C2:C10)

The result returns -$140. There are two odd numbers in column C: C3($23) and C5(-$163).

Explanation:

AmountStep 1Step 2Step 3
$782.030.03FALSE0
$23.001TRUE1
$576.740.74FALSE0
-$163.001TRUE1
$0.000FALSE0
-$2,604.000FALSE0
$56.780.78FALSE0
-$800.000FALSE0
$0.000FALSE0

You can add up the numbers in one column if the corresponding cell in another column is an odd number.

Question: What is the Sum in Column B if the corresponding cells in Column C are Odd Numbers?

=SUMPRODUCT(–(MOD(C2:C10,2)=1),B2:B10)

The result returns 1,100. There are two odd numbers in column C, and the corresponding cells in column B are B3 (800) and B5 (300).

Explanation:

Notes: The SUMPRODUCT Function

The SUMPRODUCT function adds all the multiplication results for all arrays.

Formula:

=SUMPRODUCT(array1, [array2], …)

Explanations:

– Array1 is required; the first array is to multiply and add.
– Array2 is optional; the second array is to multiply and add.

Exit mobile version