Understand the Hyphen in Excel IF Formulas and Fix Calculation Errors
Question details
The user wants to know the meaning of a hyphen in an IF formula and why rows with different end dates are returning the exact same calculation results.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Calculating the number of days between dates based on different record statuses using an IF formula.
- Observed behavior
- The formula returns a hyphen for 'Cancelled' statuses, and for other statuses, it returns the same day count regardless of differing end dates due to inconsistent cell references.
Check your formula bar to review the exact IF statement causing the issue, and identify which cells in your worksheet correspond to the start date, end date, and status columns.
Fix Inconsistent Cell References and Review Formula Logic
Identify what the hyphen represents in your syntax and correct the cell references so the formula calculates dates accurately for every row.
The hyphen ('-') in this context is simply a text string that the IF function has been instructed to return when a specific condition is met, such as when the status is 'Cancelled'. It is not a built-in Excel error.
If rows with different end dates return the exact same numeric result, the formula is likely referencing a fixed month-end date instead of the individual end dates, or there is an inconsistent row reference (like referencing E25 while on row 5) that carried over when the formula was copied down.
Click on the cell displaying the hyphen and check the formula bar at the top. You will see a condition like IF(A2="Cancelled", "-", ...) which dictates this specific text output. You can change "-" to any other text or a blank ("") if preferred.
Review the false condition of your IF statement. Ensure the row numbers match the current row you are evaluating (e.g., E5 and M5 for row 5). If you see an irregular reference like E25 in the row 5 formula, correct it to E5.
If the formula calculates days to the end of a reporting month instead of the end date (e.g., subtracting the start date from C$2), modify the formula to subtract the start date from the actual end date cell if that is your intended goal.
Convert your data into an Excel Table by selecting it and pressing Ctrl+T. Replace standard cell references in your IF formula with structured references like [@[Start Date]] and [@[End Date]]. This locks the formula to the correct row and prevents errors when copying formulas down columns.

Easily Manage Complex IF Formulas in WPS Office
WPS Spreadsheet provides intuitive formula tracking and error-checking tools, making it easy to spot inconsistent references and fix logical errors like the hyphen issue in your IF formulas.
- 1. Open your spreadsheet in WPS Office: Launch WPS Spreadsheet and open the file containing your problematic IF formula.
- 2. Use the Error Checking tool: Navigate to the Formulas tab and click 'Error Checking' to automatically find and diagnose inconsistent formula references within your columns.
- 3. Evaluate formula logic: Use the 'Evaluate Formula' feature under the Formulas tab to step through your IF calculation piece-by-piece and see exactly where the hyphen or wrong date is generated.
- 4. Apply structured references: Select your data range, press Ctrl+T to format it as a table, and rewrite your IF formula using intuitive column names for error-free auto-filling.

Frequently Asked Questions
Why does my IF formula return the same number for different end dates?
This usually happens when your formula calculates against a fixed absolute reference (like a month-end date locked with a $ sign, e.g., C$2) instead of the specific row's end date, or if a cell reference wasn't updated properly when copying the formula down.
How do I make an IF function return a blank instead of a hyphen?
To return a blank cell instead of a hyphen, replace the "-" in your IF formula with two double quotes (""). For example: IF(A2="Cancelled", "", [false_calculation]).
What are structured references in spreadsheets?
Structured references are a special syntax used in formatted Tables that reference column names (like [@[Start Date]]) rather than specific cell coordinates (like E5). This makes formulas easier to read and mathematically guarantees the formula applies to the current row.
Why did my cell reference change unexpectedly when I copied the formula?
By default, spreadsheet software uses relative references, meaning cell addresses change based on where you paste them. If you accidentally referenced a cell far away (like E25 instead of E5), pasting it down will continue incrementing that incorrect offset for all subsequent rows.




