Others

How to Sum IIf Calculations in a Microsoft Access Group Footer

Huda QurayshiHuda Qurayshi Nov 13, 2026 871 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Open the report in Design View

Right-click the report in the Access Navigation Pane and choose Design View.

2
Select the footer text box

Click the text box in the group footer where the total should be displayed.

3
Enter the numeric Sum expression

In the Property Sheet, set Control Source to =Sum(IIf([Sell]>0,([Sell]*[Price])-([Sell]*[AdjCostBase]),0)).

4
Confirm source fields are numeric

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.

Return Numeric Zero in the IIf Expression Before Applying Sum
Numeric zero avoids type mismatch: Returning 0 instead of an empty string lets Access treat the entire Sum expression as numeric.
Free Microsoft Office alternative

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. 1. Download WPS Office: Go to the official WPS Office website and click Download WPS Office Free.
  2. 2. Install and launch WPS Office: Open the downloaded installer, follow the on-screen prompts, and launch WPS Office.
  3. 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.
Avoid Access report expression errors for everyday data tasks by using WPS Spreadsheets formulasFree, lightweight Office suite with a familiar ribbon interfaceOpens and edits Microsoft Excel and Word files with strong .xlsx and .docx compatibilitySeamless migration from Microsoft Office with no paid Access license required
microsoft office alternative - wps office

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.