New Tool Radar

AI for Data & Spreadsheets

How to Check Whether an AI-Written SUMIFS with OR Criteria Silently Applies AND Instead

Check whether an AI-written SUMIFS with OR criteria silently applies AND instead, and undercounts the total.

Schematic with three steps: Read the criteria as AND, not OR; Add the matching rows by hand; Rewrite the total as two SUMIFS added.

SUMIFS adds values that meet all of its criteria at once: the criteria are joined with AND, not OR. An AI-written SUMIFS that lists two regions as two criteria therefore counts only the rows in both regions, which is none, instead of the rows in either region. For an OR question, add two SUMIFS together, or use SUMPRODUCT with an OR condition. Check the logic before trusting the total.

What you need

  • The AI-written SUMIFS formula and its criteria
  • The rows that meet either criterion, counted by hand
  • A hand total of the rows that meet either criterion

Step 1: Read the criteria as AND, not OR

Click the formula cell and read each criteria pair. SUMIFS requires every criterion to be true on the same row, so two region criteria on the same column can never both be true.

Step 2: Add the matching rows by hand

List the rows that meet the first criterion and the rows that meet the second, add their values together, and write the hand total down. If the formula’s result is much smaller, it applied AND.

Step 3: Rewrite the total as two SUMIFS added together

Write one SUMIFS for each criterion and add the two results, or use SUMPRODUCT with an OR condition. Compare the new total with the hand total.

Worked example: synthetic East or West sales

The table below is a synthetic example. It shows the expected result of checking an AI-written SUMIFS; no formula was run.

Check Value Result
Rows meeting East or West 12 Hand total 640
SUMIFS as written 0 No row is both East and West
Two SUMIFS added 640 East total plus West total
Result after fix 640 Matches the hand total

Expected result (UNTESTED). the SUMIFS with criteria East and West returns 0, because no row is in both regions; adding a SUMIFS for East to a SUMIFS for West returns 640, matching the hand total. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • SUMIFS criteria on different columns are AND by design, which is correct when every condition must hold.
  • Adding two SUMIFS double-counts a row that meets both criteria, so check for overlap first.
  • The sum range and every criteria range must be the same size, or the formula errors.
  • SUMPRODUCT with an OR condition needs the criteria written as an addition of two comparisons, not as two SUMIFS.

Sources

See all