How to Sum IIf Calculations in a Microsoft Access Group Footer
Question details
The user needs to sum an Access IIf expression in a report group footer while avoiding data type mismatch and overflow errors.
- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Building or editing a Microsoft Access report that totals conditional row values in the group footer.
- Observed behavior
- The expression returns "Data type mismatch in criteria expression" or an Overflow error when the IIf false branch uses an empty string, divides by zero, or mixes text and numeric values.
Open the Access report in Design View and check the source table or query to confirm Sell, Price, AdjCostBase, and any divisor fields are numeric.
Return Numeric Zero in the IIf Expression Before Applying Sum
Use this when the false branch currently returns an empty string or text, because Access cannot sum mixed text and numbers.
The footer control must receive a numeric value for every record. Replacing "" with 0 keeps the false condition numeric and lets the Sum function work reliably.
Right-click the report in the Access Navigation Pane and choose Design View.
Click the text box in the group footer where the total should be displayed.
In the Property Sheet, set Control Source to =Sum(IIf([Sell]>0,([Sell]*[Price])-([Sell]*[AdjCostBase]),0)).
Open the source table or query in Design View and confirm Sell, Price, and AdjCostBase use Number or Currency data types or return numeric values.

Calculate the IIf Column in the Query and Sum the Query Field
Use this when the footer expression is complex or built on a calculated field, so Access aggregates a clean numeric column instead of re-evaluating the IIf in the report.
Guard Division by Zero in Calculated Fields Used by the Sum
Use this when AdjCostBase or another calculated field divides by zero or returns Null, which can cause Overflow before the footer total.
Switch to WPS Office for Everyday Spreadsheet and Document Work
WPS Office does not replace Microsoft Access reports, but its free, lightweight suite opens Microsoft Excel and Word files, preserves formatting, and gives you a familiar interface for everyday data and document tasks without Access report expression errors.
- 1. Download WPS Office: Go to the official WPS Office website and click Download WPS Office Free.
- 2. Install and launch WPS Office: Open the downloaded installer, follow the on-screen prompts, and launch WPS Office.
- 3. Open your existing Office files: Use WPS Office to open .xlsx, .docx, or .pptx files and continue working in a familiar spreadsheet or document interface.

Frequently Asked Questions
Why does =Sum(IIf([Sell]>0, ..., "")) return “Data type mismatch in criteria expression”?
Because the empty string is text and Access cannot sum a mix of text and numeric values. Return numeric zero instead: =Sum(IIf([Sell]>0,([Sell]*[Price])-([Sell]*[AdjCostBase]),0)).
Can I sum an IIf expression directly in an Access report group footer?
Yes, if every branch returns a numeric value. Open the report in Design View, select the group footer text box, and set Control Source to =Sum(IIf([Sell]>0,([Sell]*[Price])-([Sell]*[AdjCostBase]),0)).
What causes Overflow when summing IIf in Access?
Overflow is often caused by division by zero, a calculated field returning Null, or a field using an incompatible numeric data type. Check divisors such as BookValueUnits and verify all source fields are numeric.
Should I do the IIf calculation in the report or in the query?
When possible, do the calculation in the query. Open the source query in Design View, add a column such as TotalAmount: IIf([Sell]>0,([Sell]*[Price])-([Sell]*[AdjCostBase]),0), and then use =Sum([TotalAmount]) in the report.
Does WPS Office include Microsoft Access?
No, WPS Office does not include Access, but it can open and edit Microsoft Excel, Word, and PowerPoint files for everyday spreadsheet and document work.




