Site icon ExcelNotes

How to Sum Integers

An integer has no decimals or fractions, and it returns zero when an integer subtracts itself. An integer can be a positive natural number (e.g., 1, 2, 3), a negative natural number (e.g., -1, -2, -3), or zero (0).

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 integers in column C?

=SUMPRODUCT(–(C2:C10 – ROUND(C2:C10,0)=0), C2:C10)

The result returns -3,544.

Explanation:

Profit/LossStep 1Step 2Step 3Step 4
$782.037820.03FALSE0
$23.00230TRUE1
$576.74577-0.26FALSE0
-$163.00-1630TRUE1
$0.0000TRUE1
-$2,604.00-26040TRUE1
$56.7857-0.22FALSE0
-$800.00-8000TRUE1
$0.0000TRUE1

You can also sum the values in column B when the corresponding cells in column C are integers.

Question: What is the sum of the numbers in column B when the corresponding cells in Column C are integers?

=SUMPRODUCT(–(C2:C10 – ROUND(C2:C10,0)=0), B2:B10)

The result returns 2,900.

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