#1   Report Post  
Posted to microsoft.public.excel.misc
JCS JCS is offline
external usenet poster
 
Posts: 93
Default Sumproduct Question

Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Sumproduct Question

0 is correct

After all, the E-factor will only pull from the last row and the F-factor
will only pull from the first row.
--
Gary''s Student - gsnu201001


"JCS" wrote:

Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default Sumproduct Question

John,
If you want the result of 2, put a plus (+) sign instead of the first
multiplication (*) sign.

=SUMPRODUCT((E21:E23=D21)+(F21:F23<=D21)*(G21:G23 ))

Sincerely,

Doug

"JCS" wrote:

Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John

  #4   Report Post  
Posted to microsoft.public.excel.misc
JCS JCS is offline
external usenet poster
 
Posts: 93
Default Sumproduct Question

Hi Doug,

You nailed it! Thank you! I gotta tell ya, that I thought I tried it and
that it didn't work. I've tried so many variations I don't remember what
exactly i tried. I've worked with the Sumproduct function before and have
had no problems. Could you briefly give me an expalanation of what your
solution does?

Thanks!
John

"Huber57" wrote:

John,
If you want the result of 2, put a plus (+) sign instead of the first
multiplication (*) sign.

=SUMPRODUCT((E21:E23=D21)+(F21:F23<=D21)*(G21:G23 ))

Sincerely,

Doug

"JCS" wrote:

Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John

  #5   Report Post  
Posted to microsoft.public.excel.misc
JCS JCS is offline
external usenet poster
 
Posts: 93
Default Sumproduct Question

Hi,

I got it excited to quickly. Look's like Gary is right. When I enter a 1 I
get 3 instead of 1 or if I enter 11 I get 4 instead of 3. OK, I give up what
is a better way (if any) to do this?

John

"JCS" wrote:

Hi Doug,

You nailed it! Thank you! I gotta tell ya, that I thought I tried it and
that it didn't work. I've tried so many variations I don't remember what
exactly i tried. I've worked with the Sumproduct function before and have
had no problems. Could you briefly give me an expalanation of what your
solution does?

Thanks!
John

"Huber57" wrote:

John,
If you want the result of 2, put a plus (+) sign instead of the first
multiplication (*) sign.

=SUMPRODUCT((E21:E23=D21)+(F21:F23<=D21)*(G21:G23 ))

Sincerely,

Doug

"JCS" wrote:

Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 905
Default Sumproduct Question

"JCS" wrote:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead
I get 0. Any ideas on what could be wrong?


I think your logical expression is wrong. It tests whether F21<=D21<=E21,
for example. I think you want to test whether E21<=D21<=F21. To wit:

=SUMPRODUCT((E21:E23<=D21)*(D1<=F21:F23),G21:G23)

The minor additional syntax changes might help to write such formulas
correctlyl in the future. Separating the range G21:G23 is good practice. It
will work even if some of G21:G23 are non-numeric.


----- original message -----

"JCS" wrote:
Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John

  #7   Report Post  
Posted to microsoft.public.excel.misc
JCS JCS is offline
external usenet poster
 
Posts: 93
Default Sumproduct Question

Hi,

This time I tested your solution thorougly and it works great - as I hoped
it would. Thank you so much. Also, thanks for the syntax lesson. I learned
something today. One question, What do you mean by separating G21:G23. I
substitued 1 2 and 3 with a b and c and my result was 0 everytime. I may
want to do this one day. What am i doing wrong? Again, many thanks!!

John

"Joe User" wrote:

"JCS" wrote:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead
I get 0. Any ideas on what could be wrong?


I think your logical expression is wrong. It tests whether F21<=D21<=E21,
for example. I think you want to test whether E21<=D21<=F21. To wit:

=SUMPRODUCT((E21:E23<=D21)*(D1<=F21:F23),G21:G23)

The minor additional syntax changes might help to write such formulas
correctlyl in the future. Separating the range G21:G23 is good practice. It
will work even if some of G21:G23 are non-numeric.


----- original message -----

"JCS" wrote:
Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and ran
across a problem with the function that I cannot figure out. The following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas on
what could be wrong? Or would it be better to use another function? Thanks
in advance!!

John

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 905
Default Sumproduct Question

"JCS" wrote:
What do you mean by separating G21:G23.


Yeah, that wasn't clear. I was rushed.

I meant: specifying the range as a separate argument. That is, using
",G21:G23" instead of "*G21:G23".

The difference can seen when any cell in a range contains text. (A common
example is the null string, "".)

For a simple demonstration, fill A1:A3, B1:B3 and C1:C3 with the number 1 in
each cell. Then enter the formula =SUMPRODUCT((A1:A3=1)*(B1:B3=1)*C1:C3).
The result should be 3.

Now enter "abc" into C2. The SUMPRODUCT formula above will return a #VALUE
error.

Now change the formula to =SUMPRODUCT((A1:A3=1)*(B1:B3=1),C1:C3). The
result should be 2, despite "abc" in C2.

The explanation is: SUMPRODUCT treats text values in arrays as zero,
whereas Excel treats some text in arithmetic expressions as an error.

On the other hand, text in arithmetic expressions that matches Excel's idea
of a number -- which includes date and time -- is treated as a number.
However, SUMPRODUCT does not make that distinction. Klunk!

So you need to look at the circumstances in order to decide if it is better
to use a range in an arithmetic expression or to specify it as a separate
argument.

Did that clear things up? It shouldn't have! Because Excel is a "murky"
product :-(.


----- original message -----

"JCS" wrote in message
...
Hi,

This time I tested your solution thorougly and it works great - as I hoped
it would. Thank you so much. Also, thanks for the syntax lesson. I
learned
something today. One question, What do you mean by separating G21:G23. I
substitued 1 2 and 3 with a b and c and my result was 0 everytime. I may
want to do this one day. What am i doing wrong? Again, many thanks!!

John

"Joe User" wrote:

"JCS" wrote:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead
I get 0. Any ideas on what could be wrong?


I think your logical expression is wrong. It tests whether
F21<=D21<=E21,
for example. I think you want to test whether E21<=D21<=F21. To wit:

=SUMPRODUCT((E21:E23<=D21)*(D1<=F21:F23),G21:G23)

The minor additional syntax changes might help to write such formulas
correctlyl in the future. Separating the range G21:G23 is good practice.
It
will work even if some of G21:G23 are non-numeric.


----- original message -----

"JCS" wrote:
Hi All,

I've been experiementing with the Sumproduct function in Excel 2007 and
ran
across a problem with the function that I cannot figure out. The
following
is an example: I have the following table in cells E21 to G23:

1 5 1
6 10 2
11 15 3


In cell D21 I input a value (e.g. 8)
In cell E25 I have the followng formula:
=SUMPRODUCT((E21:E23=D21)*(F21:F23<=D21)*(G21:G23 ))
In cell D21, if I enter 8 I should see 2 - instead I get 0. Any ideas
on
what could be wrong? Or would it be better to use another function?
Thanks
in advance!!

John


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct Question [email protected] Excel Discussion (Misc queries) 4 June 3rd 08 04:22 PM
Sumproduct question? capt Excel Discussion (Misc queries) 3 January 11th 08 04:43 PM
SUMPRODUCT question Barb Reinhardt Excel Worksheet Functions 9 October 2nd 06 01:42 PM
SUMPRODUCT question Lee Harris Excel Worksheet Functions 4 October 28th 05 04:06 AM
Sumproduct question Daniel Bonallack Excel Worksheet Functions 3 September 16th 05 07:13 AM


All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"