error using sumproduct

B

Bryan

I have a sheet named data. On another sheet I am trying
to so sums. The object is to move away from first
concatenate and then sumif and use a single sumproduct
formula.
The formula =sumif(Data!D:D,"oct",Data!E:E) returns a
correct numeric value
The formula =sumif(Data!C:C,"budget",Data!E:E) returns a
correct numeric value
Now I would like to combine the two to find the numeric
value for all occurrences for oct budget.

=sumproduct((Data!D:D="oct")*(Data!C:C="budget")*(Data!
E:E))
This returns #NUM!. I don't understand since the two
parts work correctly.

Any help is greatly appreciated.
 
D

Don Guillett

You cannot use D:D with sumproduct. Try D1:D1000 instead. Or use defined
names where the ranges are the same.
D1:D1000 and E1:E1000
 
B

Bryan

Cool, however, over the course of the next twelve months
I am going to have thousands of lines worth of
information. By using the D:D syntax I don't have to
worry about the range being large enough to hold all the
data. When I specify the range with a name I notice a
major lag in data calculation (the hardware is not the
issue).

Is there another way to accomplish what I want to do?
 
D

Don Guillett

Use a defined name for each range. Just make sure that they are the same
length.
insert>name>define>select a name like rngB>in the refers to box type
=offset($B$1,0,0,counta($B:$B),0) and touch enter
now for rngC use
=offset($c$1,0,0,counta($B:$B),0) and touch enter
Notice that I still used B for the count. Use the longest.

This should be faster than calculating 65536 rows
 
P

Peo Sjoblom

You can use dynamic ranges and name them

=OFFSET('Data'!$A$2,,,COUNTA('Data'!$A:$A),1)

the above would be for A in the Data sheet starting with A2,
You can do the same for the other ranges and then just do

=SUMPRODUCT((MyRange1="abcd") and so on

To name it, do insert>name>define and type a descriptive name and in the
refers to box put
a similar formula to the above, note the absolute references which is
important
 
H

Harlan Grove

Bryan said:
Cool, however, over the course of the next twelve months
I am going to have thousands of lines worth of
information. By using the D:D syntax I don't have to
worry about the range being large enough to hold all the
data. When I specify the range with a name I notice a
major lag in data calculation (the hardware is not the
issue).

Is there another way to accomplish what I want to do?
....

Since Excel can't use entire columns with SUMPRODUCT, even if you had all of
column D filled with data, neither D:D nor OFFSET(D1,0,0,65536,1) would work
as arguments to SUMPRODUCT. So you'll never be able to get SUMPRODUCT to
calculate all 65536 cells in any column. However, it happily calculates
65535 rows of data, so D$1:D$65535 would work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top