To calculate the total stock value for any part, we use the SUM function along with the IF function in Excel 2010.
SUM: – This function is used to add / sum all the numbers in a range of cells.
Syntax of SUM function: -=SUM(number1, number2,……)
For example:Cells A2:A5 contain numbers.We need to add all the numbers and show the result in cell B2.
Follow the below given steps:-
- Select the cell B2.
- Write the formula =SUM(A2:A5)
- Press Enter on the keyboard.
- The function will add all the numbers.
IF: - Checks whether a condition is met and returns one value if True and another value if False.
Syntax of “IF” function =IF(logical test,[value_if_true],[value_if_false])
First the formula will perform a logical test and return one value if the logical test is true and another value if the test is false.
For example:Cells A2 and A3 contain the numbers 3 and 5. If the number is 3, then the formula should display “Yes”, else “No”.
Let’s take an example to understand how we can calculate the total stock value for any part.
We have data showing the parts and their respective quantity sold with the amounts. We need to return the total sold amount for product A880Q.
To calculate the total stock value follow below given steps.
- Select the cell E2 and write the formula.
- Press Ctrl+Shift+Enter on your keyboard.
- The function will return the total stock value for the product A880Q.
Note: This is an array function.After entering the formula in the cell press F2 and then press Ctrl+Shift+Enter on your keyboard.
This is the way we can calculate the total stock value by using the SUM function along with the IF function in Microsoft Excel.