Vous êtes sur la page 1sur 2

3/1/2017 ExcelSUMPRODUCTformulaSyntax,Usage,ExamplesandTutorial|Chandoo.

orgLearnMicrosoftExcelOnline

CustomSearch Search

WhatisExcelSUMPRODUCTformulaandhowtouseit?
PostedonNovember10th,2009inFeatured,LearnExcel243comments

TodaywewilllearnanewandexcitingexcelformulatheallpowerfulSUMPRODUCT.

AttheoutsetSUMPRODUCTformulamaynotseemlikeallthatuseful.Butonceyouunderstandhowexcelworkswithlists(orarrays)ofdata,the
SUMPRODUCTsrelevancebecomescrystalclear.

SUMPRODUCTformulasyntaxandusage

Thesumproductformulasyntaxisverysimple.Ittakes1ormorearraysofnumbersandgetsthesumofproducts
ofcorrespondingnumbers.

Thesyntaxis=SUMPRODUCT(list1,list2...)

So,forex:ifyouhavedatalike{2,3,4}inonelistand{5,10,20}inanotherlist,andifyouapplySUMPRODUCT,you
willget120(because2*5+3*10+4*20is120).

Atthispointitmightseemlikeanalmostuselessfunction.Butallthatwillchangeinthenext2minutes,keep
reading.

SUMPRODUCTandArrays

LetssayyouhavealistofsalesdatawithcolumnsName,Region,ProductandSales.Now,youwanttoknowhowmanyunitsthesalespersonnamedLuke
sold.Thisissimple,youwillwriteaSUMIFformula[examples]andusetheNamecolumnascriteriarangeandSalescolumnassumrange.

But,waitasecond,youwanttofindhowmanyunitssalespersonLukesoldintheregionwest.

Hmm.wehave2options,

Useanarrayformula
Useapivottable[whatisapivottable?]

Actually,thereisahiddenthirdoption,useSUMPRODUCT.

Thatisright,myfriend,wecanuseSUMPRODUCTtodojustthis(andmuchmore).

UsingSUMPRODUCTasanarrayformula

Assuming,thedataisinrangeA1:D10,withNameincolumnA,RegioninB,ProductinCandSalesinD,theSUMPRODUCTformulais,

=SUMPRODUCT((A1:A10="LukeSkywalker"),(B1:B10="West"),D1:D10)

Okay,letstakeaminuteandtrytounderstandWTF(whattheformula)isdoing.

Theportion(A1:A10="LukeSkywalker")islookingforLukeSkywalkeracrossplanetarysystemsinalluniverses Itisgoingtogiveusabunchof
ONEsandZEROs,oneifthecellhasLuke,Zeroifthecellhassomethingelse.
Theportion(B1:B10="West")isdoingthesame,butgets1swhenthevalueisWest.
TheportionD1:D10isjustreturningallthesalesfigures.
Whenyouputeverythingtogetherandmultiply,itjustworks.Why?Thatisyourhomeworktofigureout.

http://chandoo.org/wp/2009/11/10/excelsumproductformula/ 1/30
3/1/2017 ExcelSUMPRODUCTformulaSyntax,Usage,ExamplesandTutorial|Chandoo.orgLearnMicrosoftExcelOnline

ShareyourSUMPRODUCTformulaTips&Tricks

SUMPRODUCTformulacandomuchmoreonceyouunderstandhowitworks.Thispostismeanttoopenthedoorforyou.Goaheadandexplorethe
possibilities,thencomebackandshareyourtipswithus.

RecommendedReading

Isuggestreadingtheexcelarrayformulaexamples,sumifwithmultipleconditionsandotherexcelformulatutorials.

Thispostispartofourspreadcheatsseries

Sharethistipwithyourfriends

Facebook 23 LinkedIn 27 Twitter Google Email Print

243ResponsestoWhatisExcelSUMPRODUCTformulaandhowtouseit?

1. CyrilZ.says:
November10,2009at10:58am

NiceexplanationChandoo,Iloveit.It's"almost"crystalclearforme.

Canyouexplaintheuseofbeforethetest?

Reply

Ahmedsays:
September5,2014at8:21am

HiChandoo!
Yourpostsarereallyhelpful,Ihaveaquerry,mentionedbelow.

Wantedtoknowwhethersumproductfunctioncanworkwithfilters.

Ihavetried,however,thesumproductvaluesdonotchangeasperlistvisiblepostfilteringthecolumn.

Thanks

Ahmed

Reply

Mateuszsays:
July29,2016at2:15pm

InordertohavefiltersaffectSUMPRODUCTyoumustuseSUBTOTALfunctionwithinSUMPRODUCT,itwouldgolike
=SUMPRODUCT(SUBTOTAL(3,A1:A10)*(A1:A10="LukeSkywalker")*(B1:B10="West")*(D1:D10))

Subtotalwithoption3herewillreturnarrayof1sand0s(1forunfilteredrow,0whenfilteredout)

Reply

2. Chandoosays:
November10,2009at11:42am

@Cyril..goodpoint.thedoublehyphenisconvertingalistofboolean(true,false)valuestoZEROsandONEs.Eachhyphenactsasanegation.When
younegatesomething,excelconvertstheunderlyingvaluestonumbersandthenreversestheSIGN.SoTRUEsbecome1sandFALSEsbecome0s.The
secondnegationreversesthisandleavesjustnumbersthusallowingsumproducttoactuallymultiplyinsteadofthrowinganerror.

Reply

3. Moatasemsays:
November10,2009at11:59am

AnotheralternativeforthisexampleistouseSUMIFSfunction,butitisavailableonlyinexcel2007&2010

Reply

4. Rakeshsays:
November10,2009at1:21pm

NicepostChandoo!!
IsthereanylimittothenumberofargumentswecanusewithSUMPRODUCTfunction?

Reply

5. GeraldHigginssays:
November10,2009at1:49pm

http://chandoo.org/wp/2009/11/10/excelsumproductformula/ 2/30

Vous aimerez peut-être aussi