Sumproduct Formula Question

ststern45

Well-known Member
Joined
Sep 17, 2005
Messages
961
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
I have a range of cells some that contain blanks.

When I enter this formula I receive a #value

Counting the number of Odd and Even numbers in a range

=SUMPRODUCT(--(MOD(P10:AS10,2)=1),--(P10:AS10<>"")) Ctrl Shift Enter

Thanks in advance!!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Apparently you have something in a cell or 2 of your range of cells that contains a non-numeric.

Also, you don't need to enter as Control+Shift+Enter with the Sumproduct(). Try without the CSE First...
 
Upvote 0
The cells that are blank contain formulas the resulted from that calculation returning an empty cell.
 
Upvote 0
Slightly different take to Jim on using CSE with SUMPRODUCT. My take is that sometimes SUMPRODUCT will not work without CSE, but if you are using CSE with SUMPRODUCT there is likely a simpler function (often SUM with CSE) that can be used instead.

For the original question, a couple of alternatives to also consider.

Odd count: =SUM(IFERROR(MOD(P10:AS10,2),0))

Even count: =-SUM(IF(P10:AS10<>"",MOD(P10:AS10,2)-1))

both confirmed with CSE
 
Upvote 0
The cells that are blank contain formulas the resulted from that calculation returning an empty cell.

I'd opt for a pair that is structured the same way:

=SUM(IF(ISNUMBER(P10:AS10),IF(MOD(P10:AS10,2)=1,1)))

=SUM(IF(ISNUMBER(P10:AS10),IF(MOD(P10:AS10,2)=0,1)))

Each must be confirmed with control+shift+enter. Note that ISNUMBER specifies the intent exactly.
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top