Calculating differences between two numbers is a common task in Excel, and there are several ways to accomplish this. Whether you're working with dates, times, or numerical values, Excel provides various formulas and functions to help you calculate the differences between two numbers.
In this article, we'll explore five ways to calculate between two numbers in Excel, including using formulas, functions, and keyboard shortcuts. We'll also provide examples and explanations to help you understand each method.
Method 1: Using the Minus Sign (-)

One of the simplest ways to calculate the difference between two numbers in Excel is to use the minus sign (-). This method involves subtracting one number from another using a basic arithmetic formula.
For example, if you want to calculate the difference between 25 and 15, you can use the formula:
=25-15
This formula will return the result 10, which is the difference between 25 and 15.
Example:
Number 1 | Number 2 | Difference |
---|---|---|
25 | 15 | =25-15 |
30 | 20 | =30-20 |
40 | 30 | =40-30 |
Method 2: Using the ABS Function

The ABS function in Excel returns the absolute value of a number, which can be useful when calculating differences between two numbers. The ABS function takes a single argument, which is the number for which you want to return the absolute value.
For example, if you want to calculate the absolute difference between 25 and 15, you can use the formula:
=ABS(25-15)
This formula will return the result 10, which is the absolute difference between 25 and 15.
Example:
Number 1 | Number 2 | Absolute Difference |
---|---|---|
25 | 15 | =ABS(25-15) |
30 | 20 | =ABS(30-20) |
40 | 30 | =ABS(40-30) |
Method 3: Using the IF Function

The IF function in Excel is a logical function that tests a condition and returns one value if the condition is true and another value if the condition is false. You can use the IF function to calculate the difference between two numbers based on a condition.
For example, if you want to calculate the difference between 25 and 15 only if 25 is greater than 15, you can use the formula:
=IF(25>15,25-15,"")
This formula will return the result 10 if 25 is greater than 15, and an empty string if 25 is not greater than 15.
Example:
Number 1 | Number 2 | Difference |
---|---|---|
25 | 15 | =IF(25>15,25-15,"") |
30 | 20 | =IF(30>20,30-20,"") |
40 | 30 | =IF(40>30,40-30,"") |
Method 4: Using the DATEDIF Function

The DATEDIF function in Excel is a date and time function that calculates the difference between two dates in a specified interval. You can use the DATEDIF function to calculate the difference between two dates in days, months, or years.
For example, if you want to calculate the difference between two dates in days, you can use the formula:
=DATEDIF(A1,B1,"D")
This formula will return the number of days between the two dates.
Example:
Date 1 | Date 2 | Difference in Days |
---|---|---|
2022-01-01 | 2022-01-15 | =DATEDIF(A1,B1,"D") |
2022-02-01 | 2022-02-28 | =DATEDIF(A1,B1,"D") |
2022-03-01 | 2022-03-31 | =DATEDIF(A1,B1,"D") |
Method 5: Using Keyboard Shortcuts

Excel provides several keyboard shortcuts that you can use to calculate the difference between two numbers quickly. One of the most common keyboard shortcuts is the minus sign (-), which you can use to subtract one number from another.
For example, if you want to calculate the difference between 25 and 15, you can select the cell that contains the formula, press the equals sign (=), type 25, press the minus sign (-), type 15, and press Enter.
This will return the result 10, which is the difference between 25 and 15.
Example:
Number 1 | Number 2 | Difference |
---|---|---|
25 | 15 | =25-15 (using keyboard shortcuts) |
30 | 20 | =30-20 (using keyboard shortcuts) |
40 | 30 | =40-30 (using keyboard shortcuts) |
Excel Calculation Gallery









In conclusion, calculating the difference between two numbers in Excel can be accomplished using various methods, including using formulas, functions, and keyboard shortcuts. By understanding these methods, you can choose the best approach for your specific needs and improve your productivity in Excel.