Summing up a range based on another range?

Pauljj

Well-known Member
Joined
Mar 28, 2004
Messages
2,047
I need to sum up the values in column L if the product codes in column C match a range of product codes in range P20 to P100

I have named the range of P20 to P100 as 'INDOCHINA'

I have tried various SUMPRODUCT formulas including this one

=SUMPRODUCT(--ISNA(MATCH(C7:C22,{"INDOCHINA"})),L7:L22)

This just gave me the entire total and not just the product codes in the named range

Any ideas please ?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The formula won't return the product codes for you as well, you either need to go down the VBA route or use a pivot table if you want it to show you which codes have matched and the SUM.
 
Upvote 0
Hi there I don't need it to show which have matched, I am trying to sum up one column based on the what codes are in the range of INDOCHINA
 
Upvote 0
I need to sum up the values in column L if the product codes in column C match a range of product codes in range P20 to P100

I have named the range of P20 to P100 as 'INDOCHINA'

I have tried various SUMPRODUCT formulas including this one

=SUMPRODUCT(--ISNA(MATCH(C7:C22,{"INDOCHINA"})),L7:L22)

This just gave me the entire total and not just the product codes in the named range

Any ideas please ?

Paul,

If INDOCHINA is the name of a range, the formula should run as:

=SUMPRODUCT(--ISNA(MATCH(C7:C22,INDOCHINA,0)),L7:L22)

Equivalently...

=SUMPRODUCT(C7:C22,"<>"&INDOCHINA,L7:L22)
 
Upvote 0
Unfortunatley this didn't seem to work for me.

Just to clarify, at present the range INDOCHINA, contains three product codes It should be summing up L7 to L22 iwhere those three product codes exist in C7 to C22

Cheers
 
Upvote 0
I've just realised what the problem is, so please ignore, may thanks for your help much appreciated


Paul
 
Upvote 0
I've just realised what the problem is, so please ignore, may thanks for your help much appreciated


Paul

=SUMPRODUCT(--ISNA(MATCH(C7:C22,INDOCHINA,0)),L7:L22)

=SUMPRODUCT(C7:C22,"<>"&INDOCHINA,L7:L22)

are formulated as No Match. If you intend the opposite:

=SUMPRODUCT(--ISNUMBER(MATCH(C7:C22,INDOCHINA,0)),L7:L22)

=SUMPRODUCT(C7:C22,INDOCHINA,L7:L22)
 
Upvote 0

Forum statistics

Threads
1,224,612
Messages
6,179,890
Members
452,948
Latest member
Dupuhini

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