Excel Formulas for Difference in Numbers: A Practical Guide

Formulas & functions · Updated November 19, 2026

To find the difference between two numbers in Excel, subtract the earlier or starting value from the later or ending value: with the starting value in A2 and the ending value in B2, enter =B2-A2. The result is positive when the ending value is larger and negative when it is smaller; use =ABS(B2-A2) if you want the size of the difference without its direction.

Basic subtraction: which number goes first?

Excel uses the minus sign for subtraction, and the order of the cell references determines the sign of the answer. If A2 contains 125 and B2 contains 143, subtracting A2 from B2 gives 18. The result means B2 is 18 greater than A2. Put the formula in a third cell, such as C2, so the original values remain available.

With the starting value in A2 and the ending value in B2, enter this in C2 to calculate the signed change:

=B2-A2

If the values are reversed—A2 is 143 and B2 is 125—the same formula returns -18. That is usually useful: the minus sign tells you the value decreased by 18. By contrast, subtracting the ending value from the starting value would report the opposite direction. With the starting value in A2 and the ending value in B2, this reverse-order formula returns -18 when A2 is 125 and B2 is 143:

=A2-B2

Choose an order that matches the question you are asking. For changes over time, a common convention is new value minus old value. For two measurements with no special direction, you may want an absolute difference instead.

Absolute difference when direction does not matter

An absolute difference reports how far apart two numbers are, always as zero or a positive value. Excel’s ABS function removes the negative sign from a result, while leaving positive results unchanged. It is useful for comparing quotes, measurements, scores, or values from two sources when you care about the gap rather than which one is higher.

With the two numbers in A2 and B2, enter this formula to return their non-negative difference:

=ABS(B2-A2)

For example, if A2 is 143 and B2 is 125, the subtraction inside ABS is -18, but the result is 18. Swapping the two inputs also returns 18. If both cells contain the same number, the difference is 0. Keep in mind that an absolute difference does not tell you which value is greater; use ordinary subtraction when direction matters.

Percentage difference and percentage change

People often say “percentage difference” when they mean percentage change from an old value to a new one. For a before-and-after comparison, calculate the change first and divide by the old value: (new value − old value) ÷ old value. The sign shows direction. A positive result is an increase, while a negative result is a decrease.

With the old value in A2 and the new value in B2, enter this formula to calculate percentage change while leaving the result blank if the old value is zero:

=IF(A2=0,"",(B2-A2)/A2)

For example, if A2 is 50 and B2 is 60, the calculation is 10 divided by 50, or 0.2. Format the result as a percentage to display 20%. If B2 is 40 instead, the formula returns -20%, a decrease. Select the result cell and choose Home > Number > Percent Style, or use Ctrl+Shift+% on Windows. On Mac, the shortcut can vary with keyboard layout; the Percent Style button in Home > Number is a reliable option.

A zero starting value needs special thought: percentage change from zero is undefined because division by zero is not possible. The example formula displays a blank in that case, but you could instead display a message or handle those rows separately. Also distinguish percentage points from percent change. A rate moving from 20% to 25% rises by 5 percentage points, but its relative increase is 25% because 5 divided by 20 equals 0.25.

Differences across rows and totals

For a table of paired figures, write one subtraction formula in the first result row and copy it down. For instance, suppose column A contains each item’s previous value and column B contains its current value, with headers in row 1. In C2, calculate the change for the first item; then use the fill handle at the lower-right corner of C2 to copy the formula to later rows. Excel adjusts the references for each row, so the next row compares A3 with B3.

For a total change, subtract the sum of the previous values from the sum of the current values. With previous values in A2:A10 and current values in B2:B10, use this formula to calculate the difference between the two totals:

=SUM(B2:B10)-SUM(A2:A10)

If the result is 275, the current total is 275 higher overall. This is not necessarily the same as adding only the positive row differences: decreases in some rows offset increases in others. Decide whether you need the net change or a total of increases alone before choosing what to calculate.

If you need the size of the total gap regardless of which total is greater, wrap the subtraction in ABS. With previous values in A2:A10 and current values in B2:B10, this formula returns a non-negative difference between the totals:

=ABS(SUM(B2:B10)-SUM(A2:A10))

Subtracting dates and times

Excel stores dates as serial numbers, so subtracting one date from another gives the number of elapsed days. With a start date in A2 and an end date in B2, enter this in C2 to find the elapsed days:

=B2-A2

For example, if A2 is 1 March 2026 and B2 is 8 March 2026, the result is 7 days. If the result appears as another date, change the result cell’s format to General or Number using Home > Number, or open Format Cells with Ctrl+1 on Windows and Command+1 on Mac. If you want to count both the start and end dates as included calendar days, add 1. With the same date layout, this formula returns 8 for those dates:

=B2-A2+1

For times on the same day, subtract the start time from the end time. With a start time in A2 and an end time in B2, use this formula to calculate the elapsed fraction of a day:

=B2-A2

Format the result as a time or duration. For totals that may exceed 24 hours, use the custom number format [h]:mm; ordinary hour formatting can roll over after 24 hours. If a shift crosses midnight and the cells contain times only, use MOD to keep the elapsed result positive. With the start time in A2 and end time in B2, this formula calculates the duration across midnight:

=MOD(B2-A2,1)

A 10:00 PM start and 2:00 AM end produce four hours with that formula. If the cells include both date and time, direct subtraction is generally preferable because the actual dates establish whether the end time is on the next day.

Rounding, units, and number formats

Formatting changes how a result looks, not the underlying arithmetic. A result displayed with two decimal places may still hold additional digits. That matters when later formulas use it. If you need the calculated difference itself rounded to two decimal places, use ROUND. With the original values in A2 and B2, enter this formula to round their difference to two decimal places:

=ROUND(B2-A2,2)

For example, if the subtraction produces 4.567, the formula returns 4.57. Rounding may be appropriate for a report, but do not round intermediate values automatically if the extra precision is meaningful to later calculations. Currency, percentages, and measurements can all use the same subtraction arithmetic; apply a suitable number format so the answer is easy to interpret.

Check that both cells use compatible units before subtracting. Subtracting 2 meters from 150 centimeters as if both numbers used the same unit gives a misleading answer. Convert one measurement first or store a consistent unit in each column. Similarly, Excel treats text that looks like a number differently from a numeric value in some operations. If subtraction returns an error or behaves unexpectedly, check for imported text, spaces, or inconsistent units rather than assuming the minus operator is wrong.

Blank cells, errors, and common mistakes

A blank cell used in ordinary arithmetic is generally treated as zero, so a simple subtraction can produce a result even when one input is missing. That may be mathematically valid but misleading in a report. If both inputs should be present before showing a result, use COUNT to test that both cells contain numbers. With the two inputs in A2 and B2, use this formula to leave the result blank unless both cells contain numeric values:

=IF(COUNT(A2,B2)<2,"",B2-A2)

COUNT includes numeric values and dates, but not text or empty cells. This makes it useful when the inputs should be numbers; it also means a number stored as text will be treated as missing by this check. Correct the source data if that is unintended. If a cell contains an error such as #VALUE!, the formula may also return an error, which can help reveal a problem rather than silently hiding it.

  • Wrong sign: Confirm the order of the references. New minus old shows the direction of change; reversing them reverses the sign.
  • Unexpected date or time display: Change the result cell’s number format. The underlying result may be right even when it is shown as a calendar date or clock time.
  • Percentage appears too large: Do not multiply by 100 and then apply percentage formatting. A decimal result such as 0.2 displays as 20% when formatted as a percentage.
  • Formula does not update as expected: Check that the cell is not formatted as Text and that calculation is set to Automatic under Formulas > Calculation Options.
  • Copied formula compares the wrong cells: Ordinary references such as A2 and B2 adjust as a formula is filled down. Inspect the references after copying, especially if you expected a fixed cell reference.

Choosing the right difference formula

Pick the calculation based on the meaning of “difference,” not just the wording. Use signed subtraction for directional change, ABS for a non-negative gap, and percentage change when the change needs to be compared with a starting value. For dates and times, direct subtraction gives elapsed time, provided the cells contain valid date or time values and the result is formatted as a duration.

  • Which is higher, and by how much? Subtract the comparison value from the reference value in the order that makes a positive result mean what you want.
  • How far apart are two values? Use ABS around the subtraction.
  • How large is the change relative to the starting point? Divide the signed change by the starting value and decide how to handle a zero baseline.
  • How many days or hours elapsed? Subtract the earlier date or time from the later one, then choose a suitable duration format.

There is no single universal formula for a “percentage difference” between two unrelated values. Some contexts use the average of the two values as a denominator, while before-and-after analysis normally uses the starting value. State the convention in your worksheet or report so readers know how the percentage was calculated.

Frequently Asked Questions

What is the simplest Excel formula to subtract two numbers?
Use a minus sign between the cell references. With the first number in A2 and the second in B2, =B2-A2 subtracts A2 from B2. The order controls whether the answer is positive or negative.

How do I show a difference as a positive number?
Use ABS around the subtraction. With the two values in A2 and B2, =ABS(B2-A2) returns their distance without indicating which value is larger.

How do I calculate percent increase or decrease in Excel?
Subtract the old value from the new value, then divide by the old value. With the old value in A2 and the new value in B2, =(B2-A2)/A2 gives the relative change; format the result as a percentage. Handle a zero old value separately because division by zero is undefined.

Why does subtracting dates show a number?
That number is the elapsed days because Excel stores dates as serial values. It is often the desired result. If it displays as a date, change the result cell’s format to General or Number; for hours and minutes, use a time or duration format instead.

How can I subtract values down an entire column?
Enter the row formula in the first result cell, then drag its fill handle down the rows that need results. Excel adjusts normal row references as it copies the formula, so check a later row to confirm it pairs the intended inputs.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.