Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
JN
 
Posts: n/a
Default sumproduct bombs out

Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))





  #2   Report Post  
Bill Kuunders
 
Posts: n/a
Default

The answer should be 1

Just enter some other numbers in C or codes in columns A and B and you'll
see what it does.

--
Greetings from New Zealand
Bill K

"JN" wrote in message
...
Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))







  #3   Report Post  
Sandy Mann
 
Posts: n/a
Default

If I understand you right, enclose your first two comparisons in additional
brackets:

=SUMPRODUCT(((A1:A2="PF")*(B1:B2={"LAN","PFT"}))*( C1:C2))


--
HTH

Sandy

Replace@mailinator with @tiscali.co.uk


"JN" wrote in message
...
Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))







  #4   Report Post  
JBoulton
 
Posts: n/a
Default

Your data and your formula return 1 for me.

What do you get?
--
Jim


"JN" wrote:

Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))





  #5   Report Post  
bj
 
Posts: n/a
Default

try
=SUMPRODUCT((A1:A2="PF")*(or(B1:B2="LAN",B1:B2="PF T"))*(C1:C2))

"JN" wrote:

Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))







  #6   Report Post  
JN
 
Posts: n/a
Default

I am getting a zero...like it doesn't recognize the cell containing the
number 1. I have used this formula earlier in the worksheet and it is
working. I did run into the same issue on another part of the spreadsheet
but if I re-typed the criteria (in this case PF), the formula would run
correctly. The range on my spreadsheet is 157-5005 and I'm using 3 col.
Here is the exact formula I am using:

COL C COL E COL Q
PF LAN 0
PF PFT 1

=SUMPRODUCT(($C$157:$C$5105="PF")*($E$157:$E$5105= {"LAN","PFT","PF"})*($Q$157:$Q$5105))



"JBoulton" wrote:

Your data and your formula return 1 for me.

What do you get?
--
Jim


"JN" wrote:

Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))





  #7   Report Post  
Bill Kuunders
 
Posts: n/a
Default

Are you sure that the original "PF" is not " PF" or "PF "

Regards
Bill K
"JN" wrote in message
...
I am getting a zero...like it doesn't recognize the cell containing the
number 1. I have used this formula earlier in the worksheet and it is
working. I did run into the same issue on another part of the spreadsheet
but if I re-typed the criteria (in this case PF), the formula would run
correctly. The range on my spreadsheet is 157-5005 and I'm using 3 col.
Here is the exact formula I am using:

COL C COL E COL Q
PF LAN 0
PF PFT 1

=SUMPRODUCT(($C$157:$C$5105="PF")*($E$157:$E$5105= {"LAN","PFT","PF"})*($Q$157:$Q$5105))



"JBoulton" wrote:

Your data and your formula return 1 for me.

What do you get?
--
Jim


"JN" wrote:

Can anyone tell me what I'm doing wrong on this example? The answer is
1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))







  #8   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

You can't inject OR in this type of formulas when the intent is to
calucutate an array instead of a single value.

bj wrote:
try
=SUMPRODUCT((A1:A2="PF")*(or(B1:B2="LAN",B1:B2="PF T"))*(C1:C2))

"JN" wrote:


Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*( C1:C2))






--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
  #9   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

It's more efficient to use:

=SUMPRODUCT(--($C$157:$C$5105="PF"),--ISNUMBER(MATCH($E$157:$E$5105,{"LAN","PFT","PF"},0 )),$Q$157:$Q$5105)

instead of

=SUMPRODUCT(($C$157:$C$5105="PF")*($E$157:$E$5105= {"LAN","PFT","PF"})*($Q$157:$Q$5105))

If you're not getting the desired figure, you have probably extraneous
chars in cells with PF, LAN, etc. Try to run the TrimAll macro on the
relevat ranges (The macro can be found by means of a search with Google).

JN wrote:
I am getting a zero...like it doesn't recognize the cell containing the
number 1. I have used this formula earlier in the worksheet and it is
working. I did run into the same issue on another part of the spreadsheet
but if I re-typed the criteria (in this case PF), the formula would run
correctly. The range on my spreadsheet is 157-5005 and I'm using 3 col.
Here is the exact formula I am using:

COL C COL E COL Q
PF LAN 0
PF PFT 1

=SUMPRODUCT(($C$157:$C$5105="PF")*($E$157:$E$5105= {"LAN","PFT","PF"})*($Q$157:$Q$5105))



"JBoulton" wrote:


Your data and your formula return 1 for me.

What do you get?
--
Jim


"JN" wrote:


Can anyone tell me what I'm doing wrong on this example? The answer is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})* (C1:C2))






--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
  #11   Report Post  
JN
 
Posts: n/a
Default

THANKS SO MUCH!!!! That is what the prob was! I was importing from a txt
file and 1/2 of the file must have had leading spaces even though it didn't
appear that way on the spreadsheet. I am so very grateful to everyone who
posted to my question!!!! I can now rest easy tonight!


"Sandy Mann" wrote:

JN

but if I re-typed the criteria (in this case PF),


Is there a possibility that you have a space before or after the letters?

Try:

=SUMPRODUCT((trim($C$157:$C$5105)="PF")*(Trim($E$1 57:$E$5105)={"LAN","PFT","
PF"})*($Q$157:$Q$5105))

And see if this makes any difference

--
HTH

Sandy

Replace@mailinator with @tiscali.co.uk


"JN" wrote in message
...
I am getting a zero...like it doesn't recognize the cell containing the
number 1. I have used this formula earlier in the worksheet and it is
working. I did run into the same issue on another part of the spreadsheet
but if I re-typed the criteria (in this case PF), the formula would run
correctly. The range on my spreadsheet is 157-5005 and I'm using 3 col.
Here is the exact formula I am using:

COL C COL E COL Q
PF LAN 0
PF PFT 1


=SUMPRODUCT(($C$157:$C$5105="PF")*($E$157:$E$5105= {"LAN","PFT","PF"})*($Q$15
7:$Q$5105))



"JBoulton" wrote:

Your data and your formula return 1 for me.

What do you get?
--
Jim


"JN" wrote:

Can anyone tell me what I'm doing wrong on this example? The answer

is 1

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))








  #12   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

Remember that...

($E$157:$E$5105={"LAN","PFT","PF"})

is not an efficient idiom.

JN wrote:
THANKS SO MUCH!!!! That is what the prob was! I was importing from a txt
file and 1/2 of the file must have had leading spaces even though it didn't
appear that way on the spreadsheet. I am so very grateful to everyone who
posted to my question!!!! I can now rest easy tonight!

[...]

--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
  #13   Report Post  
Sandy Mann
 
Posts: n/a
Default

Aladin,

"Aladin Akyurek" wrote in message
...
Remember that...

($E$157:$E$5105={"LAN","PFT","PF"})

is not an efficient idiom.


Can you verify, (or correct me if I am wrong), that the reason that you say
that it is an *inefficient idiom* is because, using the OP's original data
and formula:

COL A COL B COL C
PF LAN 0
PF PFT 1

=SUMPRODUCT((A1:A2="PF")*(B1:B2={"LAN","PFT"})*(C1 :C2))

(A1:A2="PF") evauates to TRUE;TRUE but (B1:B2={"LAN","PFT"}) evaluates to
TRUE,FALSE;FALSE,TRUE so the (A1:A2="PF") has to be evaluated twice to
match the (B1:B2={"LAN","PFT"}) whereas in
=SUMPRODUCT((A1:A2="PF")*((B1:B2="LAN")+(B1:B2="PF T"))*(C1:C2))
(A1:A2="PF") only gets evaluated once although B1:B2 still gets evaluated
twice, but then it was being evaluated twice anyway.

--

Sandy

Replace@mailinator with @tiscali.co.uk

..


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 Peter B Excel Worksheet Functions 1 March 7th 05 01:59 PM
sumproduct causing memory errors? dave Excel Worksheet Functions 1 March 3rd 05 09:31 AM
Can I reference =, <, or > sign in SUMPRODUCT BobT Excel Discussion (Misc queries) 7 February 16th 05 01:58 PM
Sumproduct function not working Scott Summerlin Excel Worksheet Functions 12 December 4th 04 05:15 AM
adding two sumproduct formulas together ski2004_2005 Excel Worksheet Functions 1 November 12th 04 09:08 PM


All times are GMT +1. The time now is 04:36 AM.

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"