New Tool Radar

AI for Data & Spreadsheets

How to Check an AI-Written SUMPRODUCT Formula for Broken Conditions

Check an AI-written SUMPRODUCT formula for text values and mismatched ranges that make its conditions fail.

Schematic with three steps: Check that every range is the same; Check that the multiplied ranges hold numbers; Compare the result with a hand total.

SUMPRODUCT multiplies arrays row by row and adds the results, which makes it a handy way to sum with several conditions. It breaks quietly when one range holds text instead of numbers, or when the ranges are different lengths: the formula then returns an error or a total that leaves rows out. Read each range for size and type before trusting the total.

What you need

  • The AI-written SUMPRODUCT formula
  • The ranges it multiplies, with their values visible
  • A hand total of the rows that meet the conditions

Step 1: Check that every range is the same size

Read each range in the formula and count its rows. All ranges must cover exactly the same rows; a range that is one row longer or shorter makes the whole formula error or misalign.

Step 2: Check that the multiplied ranges hold numbers

Look at the range being summed for text values, blanks, or numbers stored as text. Text in a multiplied range breaks the calculation, so convert or exclude those cells first.

Step 3: Compare the result with a hand total

Add by hand the values in the rows that meet all the conditions and compare with the formula result. If they differ, test each condition on its own to find which one is wrong.

Worked example: synthetic sales by region and type

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

Check Value Result
Rows meeting both conditions, added by hand 310 Hand total
AI formula result 190 Too low
Cause found Text in amount range One amount stored as text
Rows affected 1 Amount of 120 ignored
Corrected result 310 Matches the hand total

Expected result (UNTESTED). the AI formula returns 190 against a hand total of 310 because one amount of 120 is stored as text and ignored; converting it to a number gives 310. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • SUMPRODUCT treats TRUE as 1 and FALSE as 0 in conditions, so a condition that returns text instead of TRUE or FALSE breaks the maths.
  • Whole-column ranges in SUMPRODUCT are slow and can count header text as data; use bounded ranges instead.
  • A condition written as text, such as “East”, must match the cell text exactly, including spaces.
  • SUMPRODUCT cannot use a range from a closed workbook the way some other functions can; the workbook must be open.

Sources

See all