Urgent SUMPRODUCT Does not work.

jamilm

Well-known Member
Joined
Jul 21, 2011
Messages
740
Gurus,

i am confused, and i do not know what i am really missing. i am putting the condition of sumproduct but it does return the correct value. it returns the total and the criteria filter does not work.

please take a look into the file uploaded in link https://skydrive.live.com/redir?resid=D7C00A2BF29043E0!282&authkey=!ACMnN7l5sNul-XM

Sheet1 is source of data and sheet2 is where i want to put my formula in columb B SUMPRODUCT to sum the sumrange of sheet1 based on the criteria to match the country.

appreciate your help.


Excel 2010
ABCDEFGHIJKLMNOPQR
1Countries1997199819992000200120022003200420052006200720082009201020112012Totals
2Abu Dhabi937526.00711676.00127258.00412124.00181343.00148693.0083602.00705321.00175918.0027216.00623127.00413801.00672402.0092748.00785860.00518927.006617542.00
3Afghanistan544978.00864802.00328557.00398491.00151009.00169373.00570641.00174884.00773938.00886205.00189563.0013662.00376837.0067268.00745799.00964773.007220780.00
4Albania722178.00607479.00409183.00849599.00986586.00182140.00605838.00693561.00877480.0063517.00213071.00482273.00355700.00129737.00847960.00694915.008721217.00
5Algeria928072.00951906.00685024.00595924.00182293.00407607.00815725.0048995.00935532.00581201.00179045.00221596.00342495.00510717.00449213.00884393.008719738.00
6American Samoa857344.00814831.00542987.00580172.00821140.00498886.0065486.0024883.00179550.00940157.00465544.00737757.00587136.0087497.00650218.00994682.008848270.00
7Andorra355476.00526425.00428967.00185387.00112257.00273832.00236346.00663817.00724760.00651659.0029520.00353506.00626720.005168672.00
8Angola180453.00778205.00557528.00745210.00254977.00165896.00417137.00981202.00112558.00662935.00944493.00158502.00557652.00824050.00451590.00696412.008488800.00
9Anguilla965489.00539975.00481887.00783462.00443992.00328277.00291094.00868261.00252561.00110590.00208467.00427815.00134111.00961677.00752719.00626397.008176774.00
10Antarctica746210.00667204.00499435.00738105.00737376.00213987.00531707.00531162.00674346.00269192.00538664.00737290.0048330.00586768.00727566.00463294.008710636.00
11Antigua:Barbuda871815.00667126.00626736.00734106.00537175.00547782.00144702.0026291.00671698.0091836.00640484.0059809.00100967.00362451.00282105.00992003.007357086.00
12Argentina302202.00612481.0070455.00956737.00353323.00257251.008892.00983000.00378057.00422215.00933361.00824528.00517971.0044786.00554092.00797717.008017068.00
13Armenia765227.00177623.00600643.00183609.00251758.00161249.00590328.00554474.00993286.00634491.00350483.00531153.00343998.00352373.00908402.0098625.007497722.00
14Aruba308829.00196117.00232432.00863837.00961369.00407216.00280974.00968869.00753712.00947885.00453303.00731810.00273038.007379391.00
15Austral Oceania293817.00420002.00420884.00931570.00173905.00793280.0036321.00517644.00958358.00782425.00466878.00209224.00890333.00749790.00886731.00406176.008937338.00
16Australia320673.00348176.00272120.00895560.00756822.00953593.00816967.00218470.00332683.00665997.00277627.00250978.00648811.00220082.00603331.00540796.008122686.00
17Austria917145.00814099.00232169.00555706.00820870.00971075.00660254.00230117.00639540.00508702.0069443.00431686.00963865.00879475.00758393.0015686.009468225.00
18Azerbaijan965129.00627219.00187870.00114325.00576949.00262992.00638246.00467506.00739100.00351699.00597152.00452789.0018453.00317744.00982923.00444441.007744537.00
19Bahamas786398.00781888.00746064.00363161.00928443.00602711.009193.0079837.00799828.00733154.00498498.00960061.00132898.00357905.00770207.00697289.009247535.00
20Bahrain220249.00696354.00362664.00743280.00923535.00584035.00741696.00439483.00917232.00874141.00817656.00946701.0024687.00306877.00293172.00821157.009712919.00
21Bangladesh494660.00872843.00397344.00327041.00785574.0023482.00238176.00786651.00336705.00642325.00349725.00847199.00483065.00634862.00917144.00402602.008539398.00
22Barbados743509.00236583.00973610.00682360.00733647.00966871.00928264.00146517.00485258.00552076.00831570.00452946.007733211.00
23Belarus473324.00640538.00476508.00580576.00478323.00723255.00615947.00154723.00141933.00274495.00847180.00731750.006138552.00
24Belgium31444.00755835.00182955.00318377.00753323.00630496.00251102.00861636.00451012.00679682.00481492.00238586.005635940.00
25Belgium-Luxem.621043.00154289.00730073.00937618.00201640.00806830.00705419.00466874.00341075.00563040.00833703.0033152.006394756.00
26Belize272482.00302982.00976806.00421593.00242862.00319049.00951608.00238969.0049153.00511839.00406030.00265577.004958950.00
27Benin780060.00558709.00833655.00721889.00771842.00126456.00852886.00956987.00151708.0077530.00827289.00181755.006840766.00
28Bermuda670778.00470938.00935723.00432966.00840120.0025133.005922.00825077.0055776.00124678.00199117.00127869.004714097.00
29Bhutan840703.00621693.00183970.00324381.00126021.00581994.00111329.00804995.00519017.00304643.00477513.00163101.00765638.00187605.00329273.00193723.006535599.00
30Bolivia223536.00554113.00735413.00710400.00100886.0015385.00921030.00825137.00582626.00420938.00561120.00531022.00456317.00312142.00699126.0011087.007660278.00
31Bonaire524639.00959088.00197217.00786444.00431270.0060926.00338509.00682118.0014374.00270126.00732451.00879161.006903.00373135.00315900.00904674.007476935.00
32Bosnia & Herz.904171.00669850.00926639.00150594.00686516.00838620.00128344.00350546.00596315.00370644.00520203.00560840.00320888.00403504.00167765.00399856.007995295.00
33Botswana499262.00572952.0033571.00947266.00151588.00352496.0044132.00268118.00603600.00991227.00266802.0071502.00528354.00776880.00719881.00312401.007140032.00
34Bouvet Island799794.00398349.00854222.00761757.007595.00450894.0069092.00136505.00469986.00125629.00370652.0091239.00259313.00392166.00964373.00674124.006825690.00
35Br Ind Oc Terr735262.00754270.00394101.00438565.00941353.00408716.00755872.00807967.0045685.00977331.00689007.0029785.00938033.00691868.00455479.00228332.009291626.00
36Br Virgin Is346770.00638654.0044270.00208166.00205256.00145644.00737296.0035990.00111447.00670231.00724311.00920428.00481593.00668509.00252482.0093548.006284595.00
37Brazil976186.00550515.0031598.00179050.0036502.00152528.00126635.00219462.0034528.00321369.00604021.00430329.00660585.00875030.00374718.00340483.005913539.00
38Brunei371630.00492992.00267577.00265543.00704446.00248897.00977087.00918780.00517135.00842921.00302525.00942834.0096297.00505730.00565444.00489457.008509295.00
39Bulgaria489854.00158988.00249951.00775585.00917596.00465874.00740503.00625140.00597253.00944977.00331276.006296997.00
40Burkina97446.00822169.00240510.0023310.0091890.00355228.00196201.00302240.00279736.00220839.00666268.003295837.00
41Burma661.00562744.00970128.00214630.00332825.00166796.00492384.00434506.00998775.00228859.00941775.005344083.00
42Burundi726298.00780712.00750963.00807801.00977219.00513221.00323043.00218567.00214809.005312633.00
43Cambodia210209.00676742.00682897.0069089.00372757.00460786.00753663.0015159.00627889.003869191.00
44Cameroon956564.00165906.00934386.006542.00879015.00576356.00737480.00366965.00207948.004831162.00
45Canada67282.00529690.00216369.00300016.00265453.00865015.00713846.00831332.00787154.004576157.00
46Canary Islands346197.00632205.00584615.00542025.00482072.004696.0030833.001021.00326099.002949763.00
47Cape Verde766789.00753738.00102898.00286404.00657922.00406033.00734510.00183834.00106841.003998969.00
48Cayman Islands401281.00854459.00918881.00948431.00548604.00206654.00660730.00723741.00159660.00122490.00608318.00182202.00800488.00900942.008036881.00
49Cent Afr Rep351701.00857309.00876121.00235583.00389388.0013879.00480054.00985453.00344428.0036547.00841194.00754651.00198660.00659810.007024778.00
50334281941.00
Sheet1
Cell Formulas
RangeFormula
R2=SUM(B2:Q2)
R3=SUM(B3:Q3)
R4=SUM(B4:Q4)
R5=SUM(B5:Q5)
R6=SUM(B6:Q6)
R7=SUM(B7:Q7)
R8=SUM(B8:Q8)
R9=SUM(B9:Q9)
R10=SUM(B10:Q10)
R11=SUM(B11:Q11)
R12=SUM(B12:Q12)
R13=SUM(B13:Q13)
R14=SUM(B14:Q14)
R15=SUM(B15:Q15)
R16=SUM(B16:Q16)
R17=SUM(B17:Q17)
R18=SUM(B18:Q18)
R19=SUM(B19:Q19)
R20=SUM(B20:Q20)
R21=SUM(B21:Q21)
R22=SUM(B22:Q22)
R23=SUM(B23:Q23)
R24=SUM(B24:Q24)
R25=SUM(B25:Q25)
R26=SUM(B26:Q26)
R27=SUM(B27:Q27)
R28=SUM(B28:Q28)
R29=SUM(B29:Q29)
R30=SUM(B30:Q30)
R31=SUM(B31:Q31)
R32=SUM(B32:Q32)
R33=SUM(B33:Q33)
R34=SUM(B34:Q34)
R35=SUM(B35:Q35)
R36=SUM(B36:Q36)
R37=SUM(B37:Q37)
R38=SUM(B38:Q38)
R39=SUM(B39:Q39)
R40=SUM(B40:Q40)
R41=SUM(B41:Q41)
R42=SUM(B42:Q42)
R43=SUM(B43:Q43)
R44=SUM(B44:Q44)
R45=SUM(B45:Q45)
R46=SUM(B46:Q46)
R47=SUM(B47:Q47)
R48=SUM(B48:Q48)
R49=SUM(B49:Q49)
R50=SUM(R2:R49)





sheet2


Excel 2010
AB
1CountriesSum of Total Years with SUMPRODUCT
2Abu Dhabi334281941.00
3Afghanistan
4Albania
5Algeria
6American Samoa
7Andorra
8Angola
9Anguilla
10Antarctica
11Antigua:Barbuda
12Argentina
13Armenia
14Aruba
15Austral Oceania
16Australia
17Austria
18Azerbaijan
19Bahamas
20Bahrain
21Bangladesh
22Barbados
23Belarus
24Belgium
25Belgium-Luxem.
26Belize
27Benin
28Bermuda
29Bhutan
30Bolivia
31Bonaire
32Bosnia & Herz.
33Botswana
34Bouvet Island
35Br Ind Oc Terr
36Br Virgin Is
37Brazil
Sheet2
Cell Formulas
RangeFormula
B2=SUMPRODUCT(SUMRANGE)*--ISNUMBER(MATCH(A2,DynamicRange,0))
Named Ranges
NameRefers ToCells
DynamicRange=Sheet1!$A$1:INDEX(Sheet1!$A:$A,Lastrow)
SUMRANGE=Sheet1!$B$2:$Q$49
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Note the change to the named range "SUMRANGE":

Excel Workbook
AB
1CountriesSum of Total Years with SUMPRODUCT
2Abu Dhabi6617542
3Afghanistan7220780
4Albania8721217
5Algeria8719738
6American Samoa8848270
Sheet2
#VALUE!
</td></tr></table></td></tr></table>
 
Upvote 0
Thanks Oeldere for taking the time on this. but i wanted to figure out the issue with the sumproduct formula which Mr.FormR has provided solution.

I re-aranged the data in rows (with a macro).

Then it's easy to make an pivot table of it.

After the pivot table I made an graph of it.

See the filte in the link below (free dutch site).

SUMPRODUCTFILE jamilm (VBA oeldere).xlsm downloaden
 
Upvote 0
@FormR

Thanks a million. for finding the problem with this tricky issue. it works now when i change the SUMRANGE to the reference you pointed. i am just curious why the sumrange that i had which started from B2 did not trigger the criteria and when it is changed to B1 as per your advise then it worked. thought, the problem is solved, for me to learn this, i would appreciate if you could shed light on how excel works this way.

Note the change to the named range "SUMRANGE":

Sheet2

AB
CountriesSum of Total Years with SUMPRODUCT
Abu Dhabi
Afghanistan
Albania
Algeria
American Samoa

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 126px;"><col style="width: 247px;"></colgroup><tbody>
[TD="bgcolor: #CACACA, align: center"]1[/TD]

[TD="bgcolor: #CACACA, align: center"]2[/TD]

[TD="align: right"]6617542[/TD]

[TD="bgcolor: #CACACA, align: center"]3[/TD]

[TD="align: right"]7220780[/TD]

[TD="bgcolor: #CACACA, align: center"]4[/TD]

[TD="align: right"]8721217[/TD]

[TD="bgcolor: #CACACA, align: center"]5[/TD]

[TD="align: right"]8719738[/TD]

[TD="bgcolor: #CACACA, align: center"]6[/TD]

[TD="align: right"]8848270[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
B2=SUMPRODUCT(--(A2=DynamicRange)*SUMRANGE)

<tbody>
</tbody>
Names in Formulas
CellNameApplies to
B2DynamicRange=Sheet1!$A$1:INDEX(Sheet1!$A:$A,Lastrow)
B2Lastrow=LOOKUP(9.99999999999999E+307,1/(1-ISBLANK(Sheet1!$A:$A)),ROW(Sheet1!$A:$A))
B2SUMRANGE=Sheet1!$B$1:$Q$49

<tbody>
</tbody>

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
That wasn't the only problem with your formula; you closed your sumproduct right after the "SUMRANGE" - see your original formula below:

=SUMPRODUCT(SUMRANGE)*--ISNUMBER(MATCH(A2,DynamicRange,0))

But to your question, in the new formula the SUMRANGE and DYNAMIC need to consist of the same number of rows.
 
Upvote 0
Many thanks FormR

Now I understand that the ranges must be consistent .

Thanks again for the prompt help and well explained solution

Cheers

That wasn't the only problem with your formula; you closed your sumproduct right after the "SUMRANGE" - see your original formula below:

=SUMPRODUCT(SUMRANGE)*--ISNUMBER(MATCH(A2,DynamicRange,0))

But to your question, in the new formula the SUMRANGE and DYNAMIC need to consist of the same number of rows.
 
Upvote 0
Everybody is happily producing things like X*--(Y). This is something incoherent, not worth to be wedded to.

If you don't have any formulas in column A on Sheet1...

Define Lrow with Sheet1 as Scope as referring to:
Rich (BB code):
=MATCH(REPT("z",255),Sheet1!$A:$A)
Define ConditionRange as referring to:
Rich (BB code):
=Sheet1!$A$1:INDEX(Sheet1!$A:$A,Sheet1!Lrow)
Define SumRange as referring to:
Rich (BB code):
=Sheet1!$B$1:INDEX(Sheet1!$Q:$Q,Sheet1!Lrow)


Note 1. Restricting the scope of Lrow to Sheet1, allows you to use the same name also in other sheets.

Note 2. ConditionRange and SumRange are equally sized in the vertical dimension.

Note 3. With the dynamic name ranges we just defined, we can invoke formulas on Sheet2 like:

[1] just enter:

=SUMPRODUCT(SumRange*(ConditionRange=$A2))

[2] just enter:

=SUMPRODUCT(SumRange*ISNUMBER(MATCH(ConditionRange,$A2,0)))

[3] just enter:

=SUMPRODUCT(SumRange*ISNUMBER(SEARCH($A2,ConditionRange)))

[4] control+shift+enter, not just enter:

=SUM(IF(ConditionRange=$A2,SumRange)

[5] control+shift+enter, not just enter:

=SUM(IF(ISNUMBER(MATCH(ConditionRange,$A2,0)),SumRange)

[6] control+shift+enter, not just enter:

=SUM(IF(ISNUMBER(SEARCH($A2,ConditionRange)),SumRange)

Note 3. The following formula, similar to the one you have,

SUMPRODUCT(SumRange*ISNUMBER(MATCH($A2,ConditionRange,0)))

is wrong for MATCH here cannot but return a single value, not a set of values as required.

Note 4. The SumProduct formulas, [1] to [3] above, are sensitive to the text values (like blanks) in SumRange. Better to switch to a form like in 4 to 6 whenever you have to mix vectors with matrices.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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