# SUM function in Excel

SUM Function in Microsoft Excel

📌 Definition: The SUM function in Microsoft Excel is a built-in mathematical function that allows you to calculate the sum of a range of numbers or cells. It provides a quick and efficient way to add up values in Excel.

🎯 Purpose: The purpose of the SUM function is to perform addition operations and obtain the total sum of numerical values. It is commonly used for calculating totals, subtotals, and aggregating data in various business scenarios.

📋 Syntax & Arguments: To use the SUM function, follow this syntax:

syntax
```=SUM(number1, [number2], [number3], ...) ```
• `number1`, `number2`, `number3`, …: These are the numbers or cell references you want to add together. You can include multiple arguments separated by commas. The SUM function can handle up to 255 arguments.

Return Value: The SUM function returns the sum of the specified numbers or cells as a single numerical value.

🔎 Remarks:

• The SUM function ignores empty cells, text, and non-numeric values within the specified range.
• Cells with error values, such as #DIV/0! or #VALUE!, are also ignored in the calculation.
• You can use cell references, ranges, or a combination of both as arguments in the SUM function.
• The SUM function can be combined with other functions to perform more complex calculations and manipulations.

🚀 Examples with Results 🚀

1️⃣ Examples of Basic SUM Function:

Example 1: Consider the following table:

A
15
210
315
4=SUM(A1:A3)

In this example, the SUM formula is placed in cell A4. The formula `=SUM(A1:A3)` calculates the sum of the values in cells A1 to A3. The result will be displayed in cell A4 as the total sum, which in this case would be 30.

Example 2: Consider the following table:

A
17
212
318
4=SUM(A1:A3)+5

In this example, the SUM formula with an additional constant is placed in cell A4. The formula `=SUM(A1:A3)+5` calculates the sum of the values in cells A1 to A3 and adds 5 to the result. The final sum will be displayed in cell A4, which in this case would be 40.

Example 3: Consider the following table:

AB
1102
2153
3204
4=SUM(A1:B3)

In this example, the SUM formula is placed in cell B4. The formula `=SUM(A1:B3)` calculates the sum of the values in the range A1 to B3. The result will be displayed in cell B4 as the total sum, which in this case would be 54.

2️⃣ Examples of Nested SUM Function with Common Functions:

Example 4: Consider the following table:

AB
152
2104
3156
4=SUM(SUM(A1:A3), B1:B3)

In this example, the nested SUM formula is placed in cell B4. The formula `=SUM(SUM(A1:A3), B1:B3)` calculates the sum of the range A1 to A3 using the inner SUM function and then adds the values in the range B1 to B3 using the outer SUM function. The result will be displayed in cell B4, which in this case would be 42.

3️⃣ Examples of Nested SUM Function with Common Functions:

Example 5: Consider the following table:

ABC
152No
2104Yes
3156Yes
4=SUM(SUM(A1:A3), IF(C1:C3=”Yes”, B1:B3, 0))

In this example, the nested SUM formula with the IF function is placed in cell C4. The formula `=SUM(SUM(A1:A3), IF(C1:C3="Yes", B1:B3, 0))` calculates the sum of the range A1 to A3 using the inner SUM function and then adds the values in the range B1 to B3 based on the condition of whether the corresponding cell in column C is “Yes”. The result will be displayed in cell C4, which in this case would be 37.

6️⃣ Example: SUM function with vLookup function

Consider the following table:

ABC
1Apple2.5Yes
2Banana1.8No
3Orange3.2Yes
4=SUM(VLOOKUP(“Yes”, C1:C3, 2, FALSE))

In this example, the SUM formula with the VLOOKUP function is placed in cell B4. The formula `=SUM(VLOOKUP("Yes", C1:C3, 2, FALSE))` searches for the value “Yes” in the range C1 to C3 and retrieves the corresponding values from the 2nd column (column B). The SUM function then calculates the sum of these values. The result will be displayed in cell B4, which in this case would be 5.7.

7️⃣ Example: SUM function with Left function

Consider the following table:

AB
1Apple2.5
2Banana1.8
3Orange3.2
4=SUM(LEFT(A1:A3, 1)&B1:B3)

In this example, the SUM formula with the LEFT function is placed in cell B4. The formula `=SUM(LEFT(A1:A3, 1)&B1:B3)` extracts the first character from each cell in the range A1 to A3 and concatenates it with the corresponding value in column B. The SUM function then calculates the sum of these concatenated values. The result will be displayed in cell B4.

8️⃣ Example: SUM function with IF function

Consider the following table:

ABC
1Apple2.5Yes
2Banana1.8No
3Orange3.2Yes
4=SUM(IF(C1:C3=”Yes”, B1:B3, 0))

In this example, the SUM formula with the IF function is placed in cell B4. The formula `=SUM(IF(C1:C3="Yes", B1:B3, 0))` checks if the corresponding cell in column C is “Yes”. If it is, it includes the value from column B in the sum; otherwise, it includes 0. The SUM function then calculates the sum of these values. The result will be displayed in cell B4.

9️⃣ Example: SUM function with COUNTIF function

Consider the following table:

AB
1Apple2.5
2Banana1.8
3Orange3.2
4=SUM(COUNTIF(A1:A3, {“Apple”, “Banana”})*B1:B3)

In this example, the SUM formula with the COUNTIF function is placed in cell B4. The formula `=SUM(COUNTIF(A1:A3, {"Apple", "Banana"})*B1:B3)` counts the occurrences of “Apple” and “Banana” in the range A1 to A3 and multiplies the counts by the corresponding values in column B. The SUM function then calculates the sum of these multiplied values. The result will be displayed in cell B4.

🔟 Example: SUM function with CONCATENATE function

Consider the following table:

AB
1Apple2.5
2Banana1.8
3Orange3.2
4=SUM(CONCATENATE(A1:A3, B1:B3))

In this example, the SUM formula with the CONCATENATE function is placed in cell B4. The formula `=SUM(CONCATENATE(A1:A3, B1:B3))` concatenates the values in the range A1 to A3 with the corresponding values in column B. The SUM function then calculates the sum of these concatenated values. The result will be displayed in cell B4.

💡 Tips and Tricks 💡

1. Utilize named ranges to make your formulas more readable and easier to maintain.
2. Pay attention to the order of cells containing formulas. Formula cells should be placed before the cell containing the SUM function to ensure correct calculations.
3. Use absolute or mixed cell references to ensure the calculation includes the desired range.