Calculate and Format Positive and Negative Variance in Excel
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.

- 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.
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.
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.
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.
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.
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'.
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'.
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. 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. Access Cell Formatting: Select the calculated cells and press 'Ctrl + 1' on your keyboard to instantly open the Format Cells dialog box.
- 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.

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.




