You can use the SUMPRODUCT and MOD functions to have the sum of the numbers in the odd rows.
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 numbers in odd rows in column B?
=SUMPRODUCT(MOD(ROW(B2:B10),2), B2:B10)
The result returns 2,100.
Explanation:
- Step 1: ROW(B2:B10): To have the row number;
- Step 2: MOD(ROW(B2:B10),2): To have the remainder when the row number divides two. The remainder returns one when the odd row number divides two;
- Step 3: The SUMPRODUCT function returns the sum of the products of the new array and the range B2:B10.
You can use the following formula to have the sum of the numbers in column C in the odd rows.
=SUMPRODUCT(MOD(ROW(B2:B10),2), C2:C10)
The result returns -3,544.
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.