Formatting Issues

Calculate and Format Positive and Negative Variance in Excel

Muhammad TalhaMuhammad Talha Nov 10, 2026 869 views

Question details

The user needs to calculate the variance between an actual value and a target, and then format the results to visually distinguish positive variance in green and negative variance in red.

How to Calculate and Format Positive or Negative Variance in Excel
Product
Excel
Device & OS
not provided
Scenario
Creating financial reports, sales dashboards, or performance trackers where visualizing positive and negative discrepancies from a target is required.
Observed behavior
Requires a formatted spreadsheet cell that automatically calculates the difference and applies color-coded plus/minus signs based on whether the result is above or below zero.
Before you start

Ensure your data is organized into clear columns for 'Actual' and 'Target' values, and verify that the data contains valid numerical entries before applying calculations and formatting.

Solution 1Recommended

Use Custom Number Formats and Conditional Formatting

Calculate the variance using a simple subtraction formula, apply a custom number format to show plus and minus signs, and use conditional formatting rules to add green and red colors.

This method involves calculating the raw difference first, formatting it to enforce mathematical signs, and then using Excel's built-in conditional formatting tools to dynamically alter the text color based on the value.

1
Calculate the Variance

Select an empty cell where you want the variance to appear. Type the formula '=ActualCell - TargetCell' (for example, '=B2-C2') and press Enter. Drag the fill handle down to apply this formula to the rest of your column.

2
Apply Custom Number Format

Highlight the cells containing your new variance calculations. Right-click the selection and choose 'Format Cells'. Navigate to the 'Number' tab, select 'Custom' from the category list, and enter '+0;-0;0' in the Type box. Click 'OK' to display plus signs for positive numbers and minus signs for negative ones.

3
Add Conditional Formatting for Positive Values

With the variance cells still selected, go to the 'Home' tab on the ribbon. Click 'Conditional Formatting', hover over 'Highlight Cells Rules', and select 'Greater Than'. Enter '0' in the box, open the formatting dropdown, select 'Custom Format', and change the font color to Green. Click 'OK'.

4
Add Conditional Formatting for Negative Values

Keep the cells selected and return to 'Conditional Formatting' > 'Highlight Cells Rules', but this time select 'Less Than'. Enter '0' in the box, choose 'Custom Format', set the font color to Red, and click 'OK'.

Pro Tip: Do it all in one step: You can skip the Conditional Formatting menu entirely by adding colors directly to your custom number format! In the Format Cells dialog, simply type '[Green]+0;[Red]-0;0' in the Custom Type box to apply signs and colors simultaneously.
Advanced Spreadsheet Editor

Calculate and Format Variance Easily in WPS Spreadsheet

WPS Spreadsheet provides powerful custom formatting and conditional highlighting tools to help you build professional data trackers. You can easily visualize actual versus target performance in seconds.

  1. 1. Calculate Variance: Open your workbook in WPS Spreadsheet, enter your actual minus target formula (e.g., =B2-C2) in the variance column, and press Enter.
  2. 2. Access Cell Formatting: Select the calculated cells and press 'Ctrl + 1' on your keyboard to instantly open the Format Cells dialog box.
  3. 3. Apply Color and Signs: Go to the 'Custom' category, enter '[Green]+0;[Red]-0;0' in the Type field, and click 'OK' to apply color-coded variances immediately.
Instantly apply advanced custom format codes like [Green]+0;[Red]-0;0.Fully compatible with Microsoft Excel (.xlsx) formulas and formatting rules.Lightweight, fast-loading application with a familiar ribbon interface.Free to use with comprehensive data visualization and analysis tools.
microsoft office alternative - wps office

Frequently Asked Questions

How do I show variance as a percentage instead of a flat number?

To calculate percentage variance, use the formula '=(Actual-Target)/Target'. Once calculated, press Ctrl + 1 to open Format Cells, select Custom, and enter '[Green]+0%;[Red]-0%;0%' to display color-coded percentage variances.

Why are my conditional formatting colors not applying correctly?

This usually happens due to conflicting formatting rules. Go to Home > Conditional Formatting > Manage Rules. Ensure that your Greater Than and Less Than rules are at the top of the list and check the 'Stop If True' box if necessary to prioritize them.

Can I add directional arrows to my variance numbers?

Yes. Select your variance cells, go to Home > Conditional Formatting, hover over 'Icon Sets', and choose the directional arrows (e.g., green up arrow, red down arrow). This adds a clear visual indicator alongside your numbers.