To find the difference between two numbers in Excel, subtract one cell from the other: if the first number is in A2 and the second is in B2, enter =A2-B2. If A2 is 18 and B2 is 11, the result is 7; reversing the order gives -7, so choose the order based on what you want the result to mean.
How the basic subtraction formula works
Excel uses the minus sign for subtraction. A formula begins with an equals sign, followed by the first value or cell reference, a minus sign, and the second value or reference. In the example above, Excel calculates the value in A2 minus the value in B2. The formula displays the result in the cell where you entered it, while the original numbers remain unchanged.
You can subtract numbers typed directly into a formula, but cell references are usually more useful in a spreadsheet. If either input changes, Excel recalculates the result automatically. For example, a price comparison table can show the gap between two offers without requiring you to calculate it again whenever a price is updated.
The order matters because subtraction is directional: 18 minus 11 is 7, while 11 minus 18 is -7. A negative result is not an error. It means the value being subtracted from is smaller than the value subtracted. Decide which value should be treated as the starting point before copying a formula across a worksheet.
Signed difference or absolute difference?
Use ordinary subtraction when the direction of the change matters. A signed difference can tell you whether a later measurement rose or fell, whether actual spending exceeded a budget, or which of two values is larger. A positive number means the first value is greater than the second; a negative number means it is smaller.
If you only need the size of the gap and do not care which number is greater, use Excel’s ABS function. With the first value in A2 and the second value in B2, enter =ABS(A2-B2). For 11 and 18, this returns 7 regardless of which value is in A2. ABS changes a negative result to its positive magnitude; it does not change the values in the original cells.
That distinction is useful in comparisons, but an absolute difference can hide important information. If a delivery is three days early or three days late, both situations produce a magnitude of three days with ABS. Keep the signed result when early versus late, over versus under, or gain versus loss is meaningful.
Enter and copy a difference formula
In Excel for Microsoft 365 on Windows, select the cell where the answer should appear, type the formula, and press Enter. For a row of paired values, put the formula beside the first pair and copy it down. Excel adjusts ordinary relative references as the formula moves, so the next row will refer to its own inputs.
For example, if the first number is in A2 and the second is in B2, place the result in C2. With the same layout, enter =A2-B2 in C2. If A2 contains 42 and B2 contains 35, C2 returns 7. Copying that formula from C2 to C3 changes its references to A3 and B3 automatically.
You can copy a formula by dragging the small square at the bottom-right corner of the selected cell, often called the fill handle, down the column. You can also copy and paste the cell. Check the first few results after filling, especially if the data has gaps or the formula is near totals. Excel for Mac and Excel for the web use the same subtraction syntax; the exact interface for copying or filling can vary by platform.
If the formula needs to keep referring to a particular input while you copy it, use an absolute reference such as $A$2. For example, a worksheet might compare many row values with one fixed target in A2. The dollar signs keep that reference fixed when the formula is filled elsewhere. For a simple row-by-row comparison, ordinary references such as A2 and B2 are generally what you want.
Subtract values in different layouts
The same arithmetic works whether the numbers are in adjacent columns, separate parts of a sheet, or on different worksheets. For values in two cells on the same sheet, reference each cell directly. If you have a long list, make sure each row pairs the correct two measurements before filling the formula down. A correct formula applied to mismatched rows still produces a misleading answer.
To subtract a fixed number from a cell, the number can be typed into the formula. With the value in A2, enter =A2-5 to subtract 5. If A2 is 23, the result is 18. If the fixed amount may change, store it in a separate cell instead; then you can update the amount without editing every formula.
For two cells on separate worksheets, include the sheet name in the reference. If A2 is on a sheet named Sales and B2 is on a sheet named Costs, the formula can refer to both sheet names. Sheet names containing spaces need single quotation marks around the name. When building a reference by clicking cells on other sheets, Excel can insert the reference syntax for you.
Differences between dates and times
Excel stores dates as serial numbers, so subtracting one date from another returns the elapsed number of days. With the earlier date in A2 and the later date in B2, enter =B2-A2. If A2 is 1/10/2026 and B2 is 1/15/2026, the result is 5 days. The formula order here is chosen to make a later date minus an earlier date positive.
If the result appears as another date rather than a day count, change the result cell’s number format to General or Number. The underlying calculation may be right even when the display format is unexpected. Calendar dates and elapsed time are also different questions: subtracting dates counts the days between the stored dates, not necessarily business days or working hours.
Times are stored as fractions of a day. Subtracting a start time from an end time on the same day gives the elapsed time, but a shift that crosses midnight needs care. If the end time is earlier on the clock than the start time, direct subtraction gives a negative time, which may display as hash marks under some date systems or formats. For overnight work, account for the day change in the data or use a formula designed for that schedule, and verify the result with a known example.
Difference versus percentage change
A numerical difference is not the same as a percentage change. Subtraction reports the amount of change in the units of the values, such as 12 dollars or 4 items. Percentage change expresses that change relative to a starting value, so it helps compare changes across different scales.
For a percentage change, assume the original value is in A2 and the new value is in B2. Enter =(B2-A2)/A2. If A2 is 80 and B2 is 100, the result is 0.25, which is a 25% increase. Format the result cell as Percentage to display 25% instead of 0.25. A negative result indicates a decrease relative to the original value.
This calculation cannot produce a meaningful percentage change when the original value is zero, because it would divide by zero. Decide how your report should describe that case rather than treating it as an ordinary percentage. Also be clear about which value is the baseline: changing the baseline changes the percentage, even though the absolute gap between the two numbers stays the same.
Blank cells, text, and common errors
When a direct subtraction formula refers to an empty cell, Excel generally treats that blank reference as zero in the arithmetic. That can create a result that looks valid even though one input has not been entered. If both inputs are required, check the source cells or use a formula that leaves the result empty until both contain values.
With the two required inputs in A2 and B2 and the answer in C2, enter =IF(OR(A2="",B2=""),"",A2-B2). If either input is empty, the result cell displays nothing; when both are present, it subtracts B2 from A2. This is useful for unfinished tables, but note that a formula returning an empty string is not truly an empty cell. Other formulas and functions may treat it differently from a cell that has never contained a value.
A #VALUE! error commonly means that a referenced cell contains text that Excel cannot use as a number. Check for labels, stray spaces, or numbers stored as text. A displayed dash or blank may also be a number format rather than the underlying cell value. Select the cell and inspect the formula bar or change the number format to help diagnose what is stored.
- Unexpected negative result: confirm the order of the references and decide whether a signed or absolute difference is appropriate.
- Unexpectedly large result: verify that the formula points to the intended row and that the source values use compatible units.
- Formula displayed as text: check whether the cell is formatted as Text or whether the formula was entered with a leading apostrophe. Change the format if needed, then re-enter the formula.
- Result looks like a date or time: change the result cell’s number format to General or Number for ordinary numeric differences.
Choosing the right approach for your task
Before writing a formula, identify what “difference” means in your worksheet. For a directional comparison, subtract the second value from the first and interpret positive and negative results. For a gap with no direction, wrap the subtraction in ABS. For a relative increase or decrease, calculate percentage change using the original value as the baseline and format the result as a percentage.
It also helps to label the result column precisely. “Difference” can be ambiguous, while labels such as “Actual minus budget,” “Days between dates,” and “Percent change from original” explain both the calculation and the sign convention. When sharing a workbook, include units where appropriate; a result of 5 could mean five dollars, five kilograms, or five days.
For a small set of values, a direct formula is usually easiest to read and maintain. For recurring reports, consistent column headings and a filled formula column make it easier to audit the calculation. Avoid replacing formulas with manually typed answers if the source values are likely to change, since manual results will not update automatically.
Frequently Asked Questions
What is the simplest Excel formula to subtract two cells?
Use =A2-B2 when the first number is in A2 and the second is in B2. It returns the first value minus the second, including a negative result when the first value is smaller.
How do I get a positive difference in Excel?
Use ABS around the subtraction, such as =ABS(A2-B2) when the values are in A2 and B2. This returns the size of the gap without showing which value is larger.
Why does my Excel subtraction formula return a negative number?
Subtraction depends on order. A formula subtracting 18 from 11 returns -7 because 11 is smaller than 18. Reverse the cell references if you want the larger value minus the smaller one, or use ABS if direction does not matter.
Can Excel subtract dates?
Yes. Subtract an earlier date from a later date to get the number of elapsed days. If the answer displays as a date, set the result cell’s format to General or Number.
How do I calculate the percentage difference between old and new values?
For percentage change relative to an old value in A2 and a new value in B2, calculate the change divided by the old value, then format the result as Percentage. The calculation is undefined when the old value is zero, so handle that case separately.
Does Excel have a DIFFERENCE function for subtraction?
No separate DIFFERENCE function is needed for ordinary subtraction. Use the minus operator between numbers or cell references; use ABS if you want the result to be nonnegative.
Related
- How to Move Cells Down in Excel Without Overwriting Data
- How to Merge Cells in Excel: Steps and Safe Options
- Merge Day, Month, and Year in Excel
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Smartsheet SUMIF Examples for Everyday ReportsIn Smartsheet, SUMIF adds values in a sum range only when corresponding cells meet one condition. For example,…
- Excel Formula Bar Disappeared? How to Show It AgainIf the Excel formula bar disappeared, turn it back on from View > Show > Formula Bar in…
- How to Hide the Formula Bar in Excel on Windows and MacTo hide the formula bar in Excel for Microsoft 365, open the View tab, then in the Show…
- How to Find Repeated Names in Excel with COUNTIF FormulaTo find repeated names in Excel, put names in A2:A100, then enter =COUNTIF($A$2:$A$100,A2) in B2 and fill it…
- XLOOKUP Excel Cell References: A Practical GuideIn Excel, an XLOOKUP cell reference is the cell or range you tell the function to search or…
- Copy Formula in Excel Without Dragging: 6 WaysTo copy a formula in Excel without dragging, copy and paste it, use Ctrl+D to fill down, or…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.