Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Difference Between Two Numbers: Positive or Negative

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To find the difference between two numbers in Excel and show whether it is positive or negative, subtract the smaller number from the larger one in a formula such as =B2-A2. If you need to know the direction of the change (for example, whether sales went up or down), subtract the starting value from the ending value and format the result to display a plus or minus sign. This guide walks through both approaches, plus the common pitfalls and fixes.

What You'll Need

  • Microsoft Excel (any recent desktop version for Windows or Mac, or Excel for the web). The steps below use the desktop ribbon; labels can differ slightly by version and region.
  • Two numbers in separate cells, for example A2 and B2.
  • Basic familiarity with typing formulas and pressing Enter.

Step-by-Step

  1. Enter your two numbers. Put the first number in cell A2 and the second in cell B2. Use plain numbers without text or spaces; if a cell contains text, Excel treats it as text and the subtraction will return an error.
  2. Choose the subtraction order. For a simple magnitude (always positive), subtract the smaller from the larger: =MAX(A2,B2)-MIN(A2,B2). For a signed difference that shows direction, subtract the starting value from the ending value: =B2-A2. The result is positive when B2 is larger and negative when B2 is smaller.
  3. Type the formula in an empty cell. Click the cell, type =B2-A2 (or the MAX/MIN version), and press Enter. The result appears immediately.
  4. Format the result to show a plus sign for positives. Select the result cell, right-click and choose Format Cells (or press Ctrl+1 on Windows, Command+1 on Mac). On the Number tab, choose Custom and enter a format code such as +0;-0;0. This displays +5 for positive, -5 for negative, and 0 for zero. Click OK.
  5. Copy the formula down. Drag the fill handle (the small square at the bottom-right of the cell) down the column to apply the same formula to other rows. Relative references adjust automatically.
  6. Check the sign convention. If you want the opposite direction (for example, A minus B instead of B minus A), simply swap the cell references. The absolute value stays the same; only the sign flips.
  7. Optionally, use a helper column for clarity. Add a column labelled Difference and another labelled Direction. In the Direction column, use =IF(B2>A2,"Increase",IF(B2 to turn the sign into words.

Common Mistakes

  • Subtracting in the wrong order. =A2-B2 gives the opposite sign from =B2-A2. Decide which value is the starting point and stick to it across the column.
  • Leaving numbers stored as text. A number aligned to the left of the cell is often text. Use Data > Text to Columns or multiply by 1 to convert, otherwise subtraction returns #VALUE!.
  • Expecting the sign to appear automatically. Excel shows a minus sign for negatives by default but does not add a plus sign for positives unless you apply a custom format.
  • Forgetting that zero has no sign. A difference of zero is neither positive nor negative; the custom format +0;-0;0 handles this by showing plain 0.
  • Using absolute references by accident. If you copy =$B$2-$A$2 down, every row compares the same two cells. Remove the dollar signs for a relative formula.

Tips

  • Use =ABS(B2-A2) when you only care about the size of the gap and not the direction.
  • Apply a custom number format to a whole column at once by selecting the column before opening Format Cells.
  • For percentage differences, use =(B2-A2)/A2 and format the result as a percentage. Be aware that dividing by zero returns #DIV/0!.
  • Conditional formatting can colour positive results green and negative results red: select the cells, choose Home > Conditional Formatting > Highlight Cells Rules > Greater Than and set the threshold to 0.
  • If you need to compare many rows, consider a PivotTable with a calculated field rather than dozens of individual formulas.

Troubleshooting

  • The formula returns #VALUE!. One of the cells contains text, a space, or an apostrophe before the number. Clean the data or use VALUE() to convert.
  • The result shows a date instead of a number. The cell may be formatted as Date. Change the format to General or Number.
  • The sign looks wrong across rows. Check that you did not mix absolute and relative references when copying. Press Ctrl+` (grave accent) to show formulas and inspect them.
  • The plus sign does not appear. The custom format was not applied, or the cell is still formatted as General. Reapply +0;-0;0 via Format Cells.
  • Large numbers show as #####. The column is too narrow. Double-click the column border to auto-fit.

Frequently Asked Questions

How do I always get a positive difference?

Use =ABS(A2-B2) or =MAX(A2,B2)-MIN(A2,B2). Both return the distance between the numbers regardless of order.

How can I show a plus sign for positive results?

Apply a custom number format such as +0;-0;0 to the result cells. Excel does not add a plus sign by default.

Why does my subtraction return a date?

The result cell is formatted as a date. Open Format Cells and choose General or Number.

Can I calculate the difference between two columns in one step?

Yes. Enter the formula in the first row, then double-click the fill handle to copy it down the column. Ensure the references are relative, not absolute.

What if one of the numbers is zero?

The subtraction still works; the result is simply the other number with the appropriate sign. For percentage differences, guard against division by zero with IF(A2=0,"",(B2-A2)/A2).

Does this work in Excel for the web?

Yes, the formulas and Format Cells options are available in Excel for the web, though the ribbon layout may differ slightly from the desktop version.