Sumproduct using one range criteria and one fixe cell

cstlaurent

Board Regular
Joined
Jan 14, 2005
Messages
182
HI am trying to use the sumproduct using two criteria, wich it's ok up to now. But when one of the criteria as took compare the data to a range it is not working. EX: =+Sumproduct((A2:A7=(A20:a24)*(B2:B7=B20)*(C2:C7)).
I am able to use an array formula.. sum(if(or(A2:A6=A20;A2:A6=A21; and so and so);if(B2:B6=B20;C2:C6))). But was hoping there will be a simpler way using a range instead of indicating cell by cell the comparaison with the sumproduct funciton :rolleyes:

thanks in advance (y)

20001 REG 7.5
20001 ADD OT
20001 REG 7.5
20002 REG 7.5
20003 REG 7.5


range Where
20001 REG
20003
and so
and so
 
Should have (could have) posted an example earlier.
Book2
ABCD
1
21138
3211
4314
5
6
7
8
9
101
111
122
133
Sheet1


I see you're using a non English version, so please make the necessary changes.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
EUREKA..

I don't know what I was doing wrong before, put I just cut and pace this formula, and everything work just fine, Eaven with text criteria.

Big Thank you for all this.
 
Upvote 0
cstlaurent said:
EUREKA..

I don't know what I was doing wrong before, put I just cut and pace this formula, and everything work just fine, Eaven with text criteria.

Big Thank you for all this.

As an aside, I prefer the comma syntax to the asterisk one :LOL:

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A7,A11:A15,0))),--(B2:B7=B10),C2:C7)
 
Upvote 0
cstlaurent - Are you saying this works for you even if you have the text value 'OT' in your column of values, ie column C, because I don't believe it does. In your initial example data you had the value 'OT' (which i assume signified overtime) in column C.

Ken...
 
Upvote 0
KenWright said:
cstlaurent - Are you saying this works for you even if you have the text value 'OT' in your column of values, ie column C, because I don't believe it does. In your initial example data you had the value 'OT' (which i assume signified overtime) in column C.

Ken...

Ken,

With the comma syntax, you can have text values in the column to sum. I think what the OP meant was the criterias to sum are text values, but then what do I know! :LOL:
Book2
ABCD
1
211ot5
3211
4314
5
6
7
8
9
101
111
122
133
Sheet1
 
Upvote 0
Well I'm b*******

I'm absolutely gobsmacked. All the times and ways i've used that function and never come across that - I stand totally corrected, and thank you very much.

Ken...............
 
Upvote 0
Everything is just working Find, even with the *. My second criteria does mean Overtime and is text. Honestly I don't know much about the comma -- differcence. But I guess you guys know way better than me...

thanks again
 
Upvote 0
KenWright said:
cstlaurent - Are you saying this works for you even if you have the text value 'OT' in your column of values, ie column C, because I don't believe it does. In your initial example data you had the value 'OT' (which i assume signified overtime) in column C.

Ken...

Ken,

Stepping through the arrays, the #VALUE error happens because the first array with Isnumber/Match is not coerced into 1/0's without the --.and results in the error. I don't think it's because the range to sum has text values instead of numeric values.

You can still use the * syntax without the Isnumber/Match and still have text in the range to sum.
Book2
ABCD
211ot5
3111
4114
Sheet1


Maybe Aladin or one of the other MVP's will drop by and give a better answer.
 
Upvote 0
LOL - At the risk of ending up eating humble pie again:-

Assuming formula arguments identical to before but merely variations on syntax, and with a value of 'OT' in any of the cells in Col C

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A7,A11:A15,0))),(B2:B7=B10)*(C2:C7))
Errors with #VALUE - ISNUMBER... coerced via double unary, but value range contains text and is coerced via star.

=SUMPRODUCT((ISNUMBER(MATCH(A2:A7,A11:A15,0)))*(B2:B7=B10),(C2:C7))
Works fine - Value range containing text with no coercion operators, merely comma syntax.

=SUMPRODUCT((ISNUMBER(MATCH(A2:A7,A11:A15,0))),(B2:B7=B10),(C2:C7))
Doesn't error but returns 0 as neither of first two arguments based on criteria have been coerced.

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A7,A11:A15,0))),(B2:B7=B10),(C2:C7))
Doesn't error but returns 0 as second argument based on criteria has not been coerced.

=SUMPRODUCT((ISNUMBER(MATCH(A2:A7,A11:A15,0))),--(B2:B7=B10),(C2:C7))
Doesn't error but returns 0 as first argument based on criteria has not been coerced.

=SUMPRODUCT(--(ISNUMBER(MATCH(A2:A7,A11:A15,0))),--(B2:B7=B10),(C2:C7))
Works fine.

The error comes from any attempt at coercion of text, eg with the text abc in cell A1, in any other cell =A1*1 will error with #VALUE.

Ken...........
 
Upvote 0

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

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