How to Subtract Numbers in Excel?
There is no built in function in Excel to perform subtraction. Use one of the methods explained below.
In Excel, we could perform subtraction of two numbers either by using Subtraction Operator (-) in formula or by using the SUM function itself.
Lets read how to do this?
Formula To Subtract in Excel
Subtract Two Numbers Directly:
- Select a worksheet cell.
- Enter this formula ‘=5-3’ in any cell.
- Press Enter.
- Excel will calculate the difference & display result as 2.
We have just entered a Formula in Cell that starts with ‘=’ sign. If we type anything in a worksheet starting with ‘=’ sign, Excel treats it as a formula, executes the formula and display the result only.
Using Cell Reference: Similar to direct calculation, cell references can also be used in the formula as ‘=B1-C1’, then Excel will subtract the number in Columns B1 & C1.
Using SUM to Subtract: Subtraction is the same as adding negative number to another number. So, we can subtract numbers by adding a negative sign and performing a SUM operation like ‘=SUM(5,-3)’.
All the above three methods will give the same results if we provide same input. In Excel there is no function to do the subtraction directly. We have to do use the same operation as how we did with Adding Numbers in Excel.
There is a alternate approach also & it is here. Read more…
How to Find Difference between Two Numbers in Excel?
In case if we need special formula to do a subtraction, then we can write our own user defined functions (UDF). Then use them as formula in Excel worksheet.
It is just easy. A sample code is given below.
- Create a new Workbook. Press Alt + F11. Click Menu -> Insert -> Module.
- Copy paste below code. Do not press F5 or Execute the code.
- In Worksheet, enter ‘=Diff(5,3)’ in any cell.
- Excel will invoke this function. Pass parameters, finds difference and return the result.
- Press Enter. You can see the result as ‘2’ in cell.
Function SUBTRACT(Num1 As Double, Num2 As Double) As Double 'Subtract Numbers and Return the Result SUBTRACT = Num1 - Num2 End Function
Note: This function calculates the difference of 2 positive numbers. Do not enter as ‘=Diff(5,-3), since it will end up in adding the numbers. This function gets only 2 parameters. If you are in need of performing any calculation that includes more than 2 values, then the above function can be modified accordingly.