Author: Oscar Cronquist Article last updated on July 01, 2022 Show
The SUMPRODUCT function calculates the product of corresponding values and then returns the sum of each multiplication. The picture above shows how the SUMPRODUCT works in greater detail. Formula in cell B7: =SUMPRODUCT(B2:B4, C2:C4) The SUMPRODUCT function multiplies cell ranges row by row and then adds the numbers and returns a total. The formula in cell B7 multiples values 1*4= 4, 2*5 = 10 and 3*6 =18 and then adds the numbers 4+10+18 equals 32. Table of Contents
1. Excel Function SyntaxSUMPRODUCT(array1, [array2], ...) Back to top 2. Arguments
Back to top 3. Things to know about the SUMPRODUCT functionThe SUMPRODUCT function is one of the most powerful functions in Excel and is one that I often use. I highly recommend learning how it works. The SUMPRODUCT function requires you to enter it as a regular formula, not an array formula. However, there are exceptions. If you use a logical expression you must enter the formula as an array formula and convert the boolean values to their equivalents. There are workarounds to this problem which I will demonstrate in the examples below. Note, Excel 365 subscribers do not need to enter formulas as array formulas in the examples below. Microsoft has changed how array formulas work and they are now called "dynamic arrays". Back to top 4. How to use the SUMPRODUCT functionThis example demonstrates how the SUMPRODUCT function works. Formula in cell B7: =SUMPRODUCT(B2:B4, C2:C4) Back to top 4.1 Explaining formulaStep 1 - Multiplying values on the same rowThe first array is in cell range B2:B4 and the second array is in cell range C2:C4. B2:B4*C2:C4 becomes {1;2;3} * {4;5;6} becomes {1*4; 2*5; 3*6} and returns {4; 10; 18}. The same calculations are done in column D and shown in column E, see above picture. Step 2 - Return the sum of those products{4; 10; 18} becomes 4 + 10 + 18 and the function returns 32 in cell B7. The same calculation is done E5, the sum of the products in cell range E2:E4 is calculated in cell E5. See the above picture. Now you know the basics. Let's move on to something more interesting. Back to top 5. How to use a logical expression in the SUMPRODUCT functionThe image above demonstrates a formula in cell G4 that counts how many cells that is equal to the value in cell G2. Note, that this is only an example. I recommend you use the COUNTIF function to count cells based on a condition, it is designed to do that. Formula in cell G4: =SUMPRODUCT(--(B2:B6=$G$2)) Back to top 5.1 Explaining formulaStep 1 - Logical expression returns a boolean value that we must convert to numbersThere is only one array in this formula but something else is distorting the picture. A comparison operator (equal sign) and a second cell value (G2) or a comparison value. With these, we have now built a logical expression. This means that the value in cell G2 is compared to all the values in cell range B2:B6 (not case sensitive). B2:B6=$G$2 becomes {"Alaska";"California";"Arizona";"California";"Colorado"}="California" and returns {FALSE; TRUE; FALSE; TRUE; FALSE}. They are all boolean values and excel can´t sum these values. We have to convert the values to numerical values. There are a few options, you can:
They all convert boolean values to their numerical equivalents. TRUE is 1 and FALSE is 0 (zero). --( {FALSE;TRUE;FALSE;TRUE;FALSE}) becomes {0;1;0;1;0} Step 2 - Return the sum of those products{0;1;0;1;0} becomes 0 + 1 + 0 + 1 + 0 and returns 2 in cell G4. There are two cells containing the value "California" in cell range B2:B6. You accomplish the same thing using the COUNTIF function or count multiple values in different columns using the COUNTIFS function. In fact, you can count entire records in a data set using the COUNTIFS function. Back to top 6. How to use multiple conditions in the SUMPRODUCT functionThis example shows how to use multiple conditions in the SUMPRODUCT function using AND logic. AND logic means that all conditions must be met on a given row in order to add the number to the total. Formula in cell D10: =SUMPRODUCT(--(B2:B8=B10), --(C2:C8=C10),D2:D8) This formula contains three arguments, the SUMPRODUCT function allows you to use up to 30 arguments. You can make the formula somewhat shorter: =SUMPRODUCT((B2:B8=B10)*(C2:C8=C10)*D2:D8) This also allows you to have a lot more conditions than 30 if you like and use OR logic if you want. Example 4 demonstrates OR logic. It is only the available computer memory that is the limit if you use this method. The formula looks like an array formula but no, you are not required to enter it as an array formula. Back to top 6.1 Explaining formulaStep 1 - Multiplying corresponding components in the given arraysThe first logical expression B2:B8=B10 uses an equal sign to check if the values in cell range B2:B8 are equal to the value in cell B10. B2:B8=B10 becomes {"Alaska";"California";"Arizona";"California";"Colorado";"California";"Nevada"}="California" and returns {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; FALSE}. The second logical expression is C2:C8=C10, the other logical operators you can use are:
C2:C8=C10 becomes {"Anchorage";"San Diego";"Phoenix";"Los Angeles";"Denver";"Los Angeles";"Las Vegas"}="Los Angeles" and returns {FALSE; FALSE; FALSE; TRUE; FALSE; TRUE; FALSE}. The third and last logical (B2:B8=B10)*(C2:C8=C10)*D2:D8 becomes ({FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; FALSE})*({FALSE; FALSE; FALSE; TRUE; FALSE; TRUE; FALSE})*{10; 20; 40; 10; 20; 30; 10} becomes {0;0;0;1;0;1;0}*{10; 20; 40; 10; 20; 30; 10} and returns {0; 0; 0; 10; 0; 30; 0} Step 2 - Return the sum of those products{0; 0; 0; 10; 0; 30; 0} becomes 10 +30 and returns 40 in cell D10. Back to top 7. How to use OR logic in the SUMPRODUCT functionThis example shows how to use multiple conditions. A number in cell range D3:D9 is added if the item in cell B12 is found on the corresponding row in cell range B3:B9 OR if the item in C12 is found in cell range C3:C9. Formula in cell D10: =SUMPRODUCT(((B3:B9=B12)+(C3:C8=C12))*D3:D9) Back to top Explaining formula in cell D10Step 1 - Compare values to conditionThe equal sign lets you compare the condition to values in B3:B9, the result is an array with the same size as B3:B9 containing TRUE or FALSE. B3:B9=B12 becomes {"Alaska"; "California"; "Arizona"; "California"; "Colorado"; "California"; "Nevada"}="California" and returns {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; FALSE}. Step 2 - Compare values to conditionC3:C8=C12 becomes {"Anchorage"; "San Diego"; "Phoenix"; "Los Angeles"; "Denver"; "Los Angeles"; "Las Vegas"}="Las Vegas" and returns {FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE}. Step 3 - Apply OR logicWe need to add numbers if at least one of the conditions matches on the same row, this means OR logic. Mathematical operators between arrays allow you to do more complicated calculations, like this: * (asterisk) - Both logical expressions must match (AND logic) + (plus sign) - Any of the logical expressions must match, it can be all it can be only one. It doesn't matter. (OR logic) The AND logic behind this is that
The OR logic works like this:
The numbers above show the numerical equivalent of each result. True equals 1 and False equals 0 (zero). The parentheses shown below let you control the order of calculation, we must do the comparisons before we add the arrays. (B2:B8=B10)+(C2:C8=C10) becomes {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; FALSE} + {FALSE; FALSE; FALSE; FALSE; FALSE; FALSE; TRUE} and returns {0; 1; 0; 1; 0; 1; 1}. Step 4 - Check if result is larger than 0 (zero)If both values match the conditions the result is two, the result will be twice as much. We can't multiply with two, the larger than character checks if the result is larger than 0 (zero). ((B3:B9=B12)+(C3:C9=C12))>0 becomes {0; 1; 0; 1; 0; 1; 1}>0 and returns {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; TRUE}. Step 5 - Multiply with numbers((B2:B8=B10)+(C2:C8=C10))*D2:D8 becomes {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; TRUE}*D2:D8 becomes {FALSE; TRUE; FALSE; TRUE; FALSE; TRUE; TRUE}*{10; 20; 40; 10; 20; 30; 10} and returns {0; 20; 0; 10; 0; 30; 10}. Step 6 - Add numbers and return totalSUMPRODUCT(((B2:B8=B10)+(C2:C8=C10))*D2:D8) becomes SUMPRODUCT({0; 20; 0; 10; 0; 30; 10}) and returns 70. These expressions check if California is found in cell range B2:B8 or Las Vegas is found in cell range C2:C8. They are found in rows 4, 6,8, and 9. The SUMPRODUCT function sums the corresponding values in column D and returns 70 in cell D10. 20+10+30+10 equals 70. Back to top Back to top Recommended articles
'SUMPRODUCT' function examplesThe following 78 articles contain the SUMPRODUCT function.
AVERAGE ignore blanks
Calculate machine
utilization
Convert dates into date ranges
Count a specific weekday in a date range
Count cells with text
Count dates inside a date range
Count groups in calendar
Count rows with data
Count specific WEEKDAYS between two dates
Count unique distinct months
Count unique distinct records
Count unique distinct values
Create a random playlist
Create number series
Dependent drop-down lists in multiple
rows
Dynamic team generator
Find empty cells and sum cells above
Find latest date based on a condition
Free School Schedule Template
Heat map yearly calendar
Highlight cells based on ranges
Highlight duplicate records
Highlight duplicates with same date, week or month
Highlight records [AND logic]
How to create running totals
Identify overlapping date ranges
If cell contains multiple values
Lookup two index columns
Plot date ranges in a calendar part 2
Running totals based on criteria
Sort based on frequency and criteria
Sum based on OR – AND logic
Sum cells based on criteria
Sum cells with check boxes
Sum numbers between two dates
Sum unique distinct invoices
Sum unique distinct numbers
Sum unique numbers
SUMPRODUCT – multiple criteria
SUMPRODUCT and IF function
SUMPRODUCT and nested IF functions
SUMPRODUCT if not blank
Team Generator
Tracking a stock portfolio #2
True round-robin tournament
Working with overlapping date ranges Functions in this articleFunctions in 'Math and trigonometry' categoryThe SUMPRODUCT function function is one of many functions in the 'Math and trigonometry' category. Converts negative numbers to positive numbers. Calculates the arccosine, or inverse cosine, of a number. Calculates the inverse hyperbolic cosine of a number. Calculates the inverse cotangent of a number. Calculates the inverse hyperbolic cotangent of a number. Perform different specific functions to a list or database. Calculates the arcsine of a number. Calculates the inverse hyperbolic sine of a number. Calculates the arctangent of a number. Calculates the arctangent of an angle using specific x- and y-coordinates. Calculates the inverse hyperbolic tangent of a number. Converts a number into a text representation with a given radix (base). Rounds a number up to its nearest multiple. Returns the number of combinations for a specific number of elements out of a larger group. Calculates the number of combinations for a given number of elements from a larger group of elements. Calculates the cosine of an angle. Calculates the hyperbolic cosine of a number. Calculates the cotangent of an angle specified in radians. Calculates the hyperbolic cotangent of a hyperbolic angle. Calculates the cosecant of an angle (radians). Converts a text representation of a number in a given base into a decimal number. Calculates degrees from radians. Rounds a number up to the nearest even whole number. Returns e raised to the power of a number, e equals 2.71828182845904. Returns the factorial of a number. Returns the double factorial of a number. Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text. Rounds a number down to the nearest integer or to the nearest multiple of significance. Rounds a number down to the nearest integer or nearest multiple of significance. Calculates the greatest common divisor that divides all given arguments without a remainder. Removes the decimal part from positive numbers and returns the whole number (integer) except negative values are rounded down to the nearest integer. Calculates the least common multiple. The least common multiple is the smallest positive integer that is a multiple of all integer arguments. Use the LCM function to find fractions with different denominators. Lets you name intermediate calculation results which can shorten formulas considerably and improve performance. Calculates the natural logarithm of a number. Natural logarithms are based on the constant e. Calculates the logarithm of a number to a specific base. Calculates the logarithm of a number using the base 10. Calculates the inverse matrix for a given array. Calculates the matrix product of two arrays, an array as the same number of rows as array1 and columns as array2. Returns the remainder after a number is divided by divisor. Calculates a number rounded to a given multiple. Calculates the ratio of the factorial of a sum of values to the product of factorials. Calculates the identity matrix for a given dimension Returns the number pi (¶). Calculates a number raised to a power. Returns the product of the numbers given in the argument. Returns the integer portion of a division. Converts degrees to radians. Calculates a random real number greater than or equal to 0 and less than 1. Creates an array of random numbers Returns a random whole number between the numbers you specify. Rounds a number based on the number of digits you specify. Rounds a number down based on the number of digits to which you want to round the number. Calculates a number rounded up based on the number of digits to which you want to round the number. Calculates the secant of an angle. Calculates the hyperbolic secant of an angle. Creates a list of sequential numbers Calculates the sum of a power series based on a formula. Returns the sign of a number. 1 for a positiv number, 0 (zero) for a 0 (zero) and -1 for a negative number. Calculates the sine of an angle. Calculates the hyperbolic sine of a number. Calculates the positive square root. Returns a subtotal from a list or database, you can choose from a variety of arguments that determine what you want the function to do. Allows you to add numerical values, the function returns the sum in the cell it is entered in. The SUM function is cleverly designed to ignore text and boolean values, adding only numbers. Sums numerical values based on a condition. Adds numbers based on criteria. Calculates the product of corresponding values and then returns the sum of each multiplication. Calculates the sum of the squares of the arguments. Calculates the sum of the difference of squares of corresponding values in two arrays. Calculates the sum of the sum of squares of corresponding values in two arrays. Calculates the sum of squares of differences of corresponding values in two arrays. Calculates the tangent of an angle. Calculates the hyperbolic tangent of a number. Removes the fractional part of the number to an integer. Excel function categoriesExcel functions that let you resize, combine, and shape arrays. Functions for backward compatibility with earlier Excel versions. Compatibility functions are replaced with newer functions with improved accuracy. Use the new functions if compatibility isn't required. Perform basic operations to a database-like structure. Functions that let you perform calculations to Excel date and time values. Let's you manipulate binary numbers, convert values between different numeral systems, and calculate imaginary numbers. Calculate present value, interest, accumulated interest, principal, accumulated principal, depreciation, payment, price, growth, yield for securities, and other financial calculations. Functions that let you get information from a cell, formatting, formula, worksheet, workbook, filepath, and other entitites. Functions that let you return and manipulate logical values, and also control formula calculations based on logical expressions. These functions let you sort, lookup, get external data like stock quotes, filter values based a condition or criteria, and get the relative position of a given value in a specific cell range. They also let you calculate row, column, and other properties of cell references. You will find functions in this category that calculates random values, round numerical values, create sequential numbers, trigonometry, and more. Calculate distributions, binomial distributions, exponential distribution, probabilities, variance, covariance, confidence interval, frequency, geometric mean, standard deviation, average, median, and other statistical metrics. Functions that let you manipulate text values, substitute strings, find string in value, extract a substring in a string, convert characters to ANSI code among other functions. Get data from the internet, extract data from an XML string and more. Excel categoriesLatest updated articles. More than 300 Excel functions with detailed information including syntax, arguments, return values, and examples for most of the functions used in Excel formulas. More than 1300 formulas organized in subcategories. Excel Tables simplifies your work with data, adding or removing data, filtering, totals, sorting, enhance readability using cell formatting, cell references, formulas, and more. Allows you to filter data based on selected value , a given text, or other criteria. It also lets you filter existing data or move filtered values to a new location. Lets you control what a user can type into a cell. It allows you to specifiy conditions and show a custom message if entered data is not valid. Lets the user work more efficiently by showing a list that the user can select a value from. This lets you control what is shown in the list and is faster than typing into a cell. Lets you name one or more cells, this makes it easier to find cells using the Name box, read and understand formulas containing names instead of cell references. The Excel Solver is a free add-in that uses objective cells, constraints based on formulas on a worksheet to perform what-if analysis and other decision problems like permutations and combinations. An Excel feature that lets you visualize data in a graph. Format cells or cell values based a condition or criteria, there a multiple built-in Conditional Formatting tools you can use or use a custom-made conditional formatting formula. Lets you quickly summarize vast amounts of data in a very user-friendly way. This powerful Excel feature lets you then analyze, organize and categorize important data efficiently. VBA stands for Visual Basic for Applications and is a computer programming language developed by Microsoft, it allows you to automate time-consuming tasks and create custom functions. A program or subroutine built in VBA that anyone can create. Use the macro-recorder to quickly create your own VBA macros. UDF stands for User Defined Functions and is custom built functions anyone can create. A list of all published articles. When you copy a formula from cell A10 to cell B10 What happens to the cell references in the formula quizlet?When you copy a formula from cell A10 to cell B10, what happens to the cell references in the formula? Excel changes the cell references in the copied formula to reflect the new location of the formula.
Which of the following cancels a formula before it is completed?To cancel a formula before it is complete, press Esc.
Which of the following is always the first character in a formula?A formula always begins with an equal sign (=). Excel for the web interprets the characters that follow the equal sign as a formula.
Which of the following functions counts cells that meet the criteria arguments within a range?The COUNTIF Function[1] will count the number of cells that meet a specific criterion.
|