Handle cost and revenue variance signs in Excel

Standardize variance calculations across mixed revenue and expense lines so favorable outcomes consistently display correctly.

Text prompt for ChatGPT and Claude

You get: Dynamic Formula, self-Contained Solution and custom Number Formatting

Prompt

Prompt
Act as a financial modeling expert. Provide clean Excel variance formulas for financial statements containing both revenue lines and cost lines.

- Fix the issue where favorable cost savings show as negative numbers while revenue gains show as positive.
- Provide an automated formula that references a line type column (e.g., 'Revenue' vs 'Cost').
- Provide a clean solution for single-column P&L structures without helper columns.
- Detail standard financial display formatting for positive, negative, and zero variances.

Output format:
1. Dynamic Formula (Referencing Line Type)
2. Self-Contained Solution (No Type Column)
3. Custom Number Formatting
4. Reporting Best Practices

My line item details and sample rows are below:

Example output

Variance sign logic by line typeFavorable results always show as positive
ItemRevenueExpense
Variance formulaActual - BudgetBudget - Actual
Favorable whenActual is higherActual is lower
Unfavorable whenActual is lowerActual is higher
Excel formulaC2-D2D2-C2

Example for: Column A = Line Item, Column B = Type (Revenue/Expense), Column C = Actual, Column D = Budget

1. Dynamic Formula (Referencing Line Type)

In cell E2 (Variance $):
=IF(B2="Revenue", C2-D2, D2-C2)

In cell F2 (Variance %):
=IF(D2=0, "-", IF(B2="Revenue", (C2-D2)/D2, (D2-C2)/D2))

Logic: Higher actual revenue is favorable (+), while higher actual cost is unfavorable (-).

2. Self-Contained Solution (No Type Column)

If you do not have a line type column, assign sign logic via account code ranges or an IFS condition:

=LET(act, C2, bgt, D2, isCost, ISNUMBER(SEARCH("Expense", A2)), IF(isCost, bgt - act, act - bgt))

Or using an account number rule (e.g., accounts >= 5000 are expenses):
=IF(A2>=5000, D2-C2, C2-D2)

3. Custom Number Formatting

Apply this custom format to clearly label direction without relying on ambiguous minus signs:
+$#,##0 "Fav";($#,##0) "Unfav";$0

For percentage variances:
+0.0% "Fav";(0.0%) "Unfav";0.0%

4. Reporting Best Practices
  • Label the Column Clearly: Label the column 'Variance Favorable / (Unfavorable)' so stakeholders understand that positive numbers always reflect positive business outcomes.
  • Avoid Ambiguity: Never use plain (Actual - Budget) for cost lines in executive summaries; saving $10,000 should never appear as a negative line item.
Written by AI from this prompt. Your results will vary.

Paste your account names, categories, and column letters into ChatGPT, Claude, or Gemini after the prompt. Ask the model for custom conditional formatting to color code favorable vs unfavorable results.

Reuse it: Use in a workflowTurn into a skillAdapt in the builder

Excel & Spreadsheets

Build a price versus volume variance model

Deconstruct total revenue variance into distinct price, volume, and mix impacts. Ideal for commercial finance reviews when top-line changes need clear operational attribution.

Excel & Spreadsheets

Fix divide-by-zero errors in Excel variance formulas

Eliminate #DIV/0! errors in budget variance calculations with clean, professional handling for zero or missing values.

Excel & Spreadsheets

Build a Budget vs Actual Variance Analysis That Separates Timing from Overspend

Get a variance table with dollar and percent variances, a materiality filter, timing vs permanent labels, short explanations with next actions, and Excel formulas.

Excel & Spreadsheets

Categorize bank statements with keyword lookup rules

Turn raw, messy bank transactions into organized expense categories using an automated keyword matching formula.

Excel & Spreadsheets

Convert mixed date orders and CSV decimal separators

Provides quick formulas and native text conversions to standardize mismatched US and European date formats and decimal commas.

Excel & SpreadsheetsGemini

Build a Two-Variable Sensitivity Table for Revenue and Margin

Get a complete Excel sensitivity table layout with dynamic formulas and conditional formatting rules to highlight break-even profit thresholds.