Can I reference =, <, or > sign in SUMPRODUCT

B

BobT

Thanks to Biff for the last response.

One more for the group: Can I reference the "=", "<",
or ">" etc sign in a SUMPRODUCT function of the following
form:

"=SUMPRODUCT((Range1=Criteria1)*(Range2>Criteria2)*
(Range3<Criteria3)"

I can use an indirect to reference the range, and direct
references to the criteria. In countif and sumif functions
I can direct reference "=", "<", or ">" etc signs but
can't seem to get it right for this sumproduct function.

If you have a way, please check out the min, max and mode
formulae below for the same question.

Thanks
BobT


Hi!

All are array formulas, enter with the key combo of
CTRL,SHIFT,ENTER:

=MODE(IF(A1:A10="x",IF(B1:B10="y",IF(C1:C10="z",D1:D10))))

=MIN(IF(A1:A10="x",IF(B1:B10="y",IF(C1:C10="z",D1:D10))))

=MAX(IF(A1:A10="x",IF(B1:B10="y",IF(C1:C10="z",D1:D10))))

Biff
 
B

Bob Phillips

That SUMPRODUCT formula already uses >, < and =, so the answer is yes is it
not?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
B

BobT

I'm trying to refence the range and criteria so that I can
change them easily to look at different columns of data
and different criteria. Consider the following where
ranges are defined in column A and criteria in Column B.

=SUMPRODUCT((INDIRECT(A1)=B1)*(INDIRECT(A2)=B2)*(INDIRECT
(A3)=B3)*(INDIRECT(A4)=B4))

This works, but if I try to reference the = sign or a < or
sign in column C that doesn't work.

It will work in a sumif or countif function
=Sumif(indirect(A1),C1&B1) where ranges are defined in
column A, criteria in Column B, and =, <, >, =<, =>, or <>
in column C.
 
B

Bob Phillips

This works fine for me

=SUMPRODUCT((INDIRECT(A1)=B1)*(INDIRECT(A2)>=B2)*(INDIRECT(A3)=B3)*(INDIRECT
(A4)=B4))

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
B

BobT

Right
I can reference the range and the criteria, but not the =,
<, etc condition. I want to be able to reference the
condition also. I'm trying to set up a cross tab for
survey data that is flexible so it can adapted to
different surveys. I might want to show an age range in
one column, requiring => and <= conditions, but in another
column i might want females in the Northeast, requiring
two = conditions. I want to be able to change the =, <, >
condtions at the top of the column and have the SUMPRODUCT
function reference that without going into the formula and
 
P

Peo Sjoblom

You'd need to use a macro for that, maybe an input box. I personally avoid
using indirect because it is
volatile and IMHO it is overkill
 
H

Herbert Seidenberg

How about adding a unique pattern of spaces to the operator in the
formula and then doing a Replace?
Example: (^ are spaces)
=Sumproduct((Range1^=^Criteria1)*(Range2^^>^Criteria2)*(Range3^^^<^Criteria3))
This prevents the same operators in different locations from being
changed.
 
B

BobT

Thanks
I was resigned to writing a macro or manually using
replace to change the operator when needed. This tip will
be very helpful either way.
 

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