Vous êtes sur la page 1sur 9

(/author/JDSartain/)

MAXPRODUCTIVITY(/COLUMN/MAX-PRODUCTIVITY/)
ByJDSartain(/author/JDSartain/),PCWorld
MAR10,20179:59AMPT

UPDATE

Excellogicalformulas:8simpleIFstatementstogetstarted
Thisiswherethenumber-crunchingfunstarts.LearntheinsandoutsofthelogicalformulaslikethefamousIFStatementsthatrepresentthe
heartofExcel.

(https://www.facebook.com/sharer/sharer.php?
u=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftwareproductivity%2Fexcellogical
formulas5simpleifstatementstogetstarted.html)

(https://twitter.com/intent/tweet?url=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftware
productivity%2Fexcellogicalformulas5simpleifstatementstoget
started.html&via=pcworld&text=Excel+logical+formulas%3A+8+simple+IF+statements+to+get+started)

(https://plus.google.com/share?url=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftware
productivity%2Fexcellogicalformulas5simpleifstatementstogetstarted.html)

(https://pinterest.com/pin/create/bookmarklet/?
url=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftwareproductivity%2Fexcellogical
formulas5simpleifstatementstoget
started.html&description=Excel+logical+formulas%3A+8+simple+IF+statements+to+get+started)

(http://reddit.com/submit?url=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftware
productivity%2Fexcellogicalformulas5simpleifstatementstoget
started.html&title=Excel+logical+formulas%3A+8+simple+IF+statements+to+get+started)
HowExcellogicalfunctionscandothenumber-crunchingworkforyou(3:58)

(/article/3139813/gadgets/15offlifestrawpersonalwaterfilterdealalert.html)
37%offLifeStrawPersonalWaterFilter-DealAlert(/article/3139813/gadgets/15-off-lifestraw-personal-water-filter-deal-alert.html)

(/article/3112951/mobile/50offloopworldwidetraveladapterwithdualusbchargingportsdealalert.html)
58%offLOOPWorldwideTravelAdapterwithDualUSBChargingPorts-DealAlert(/article/3112951/mobile/50-off-loop-worldwide-travel-adapter-with-dual-
usb-charging-ports-deal-alert.html)

(/article/3187546/mobile/amazonunveilsdeepdiscountsonselectunlockedphonestuesandwedonlydealalert.html)
AmazonUnveilsDeepDiscountsOnSelectUnlockedPhones,TuesandWedOnly-...(/article/3187546/mobile/amazon-unveils-deep-discounts-on-select-
unlocked-phones-tues-and-wed-only-deal-alert.html)

LATESTREVIEWS

LiteratureandLatteScrivenerforWindows

(/article/2366153/reviewscrivenerforwindowsletsyouwriteepicnovelsofficememos.html)

NevercenterLtd.Co.CameraBag2.6

(/article/2453393/camerabag26reviewphotoeditorbringsthepowerandspeedofinstagramtowindows.html)

Shortcutfoo,LLCShortcutFoo

(/article/2838589/reviewshortcutfooturnsyouintoakeyboardhotkeyninja.html)

Excelfunctions,orformulas,lieattheheartoftheapplicationsdeepwellofcapabilities.TodaywelltackleIFstatements,astringof
commandsthatdeterminewhetheraconditionismetornot.Justlikeayesnoquestion,ifthespecifiedconditionistrue,Excelreturns
oneuserdeterminedvalueand,iffalse,itreturnsanother.
TheIFstatementisalsoknownasalogicalformula:IF,then,else.Ifsomethingistrue,thendothis,else/otherwisedothat.Forexample,
ifitsraining,thenclosethewindows,else/otherwiseleavethewindowsopen.

Thesyntax(orsentencestructurethatis,thewaythecommandsareorganizedintheformula)ofanExcelIFstatementis:
=IF(logic_test,value_iftrue,value_if_false).IFstatementsareusedinallprogramminglanguagesand,althoughthesyntaxmayvary
slightly,thefunctionprovidesthesameresults.

[Furtherreading:YournewPCneedsthese15free,excellentprograms](http://www.pcworld.com/article/2082305/your-new-pc-needs-
these-22-free-programs)

Remember:LearningExcelfunctions/formulasandhowtheyworkarethefirststepstowardusingVisualBasic,Microsoftseventdriven
programminglanguage.HerearefiveeasyIFstatementstogetyoustarted.

Past-duenotices
Inthisspreadsheet,thecustomerspaymentduedateislistedincolumnA,thepaymentstatusisshownincolumnB,andthecustomers
companynameisincolumnC.Thecompanyaccountantentersthedatethateachpaymentarrives,whichgeneratesthisExcel
spreadsheet.ThebookkeeperentersaformulaincolumnBthatcalculateswhichcustomersaremorethan30dayspastdue,thensends
latenoticesaccordingly.

A.Entertheformula:=TODAY()incellA1,whichdisplaysasthecurrentdate.

B.Entertheformula:=IF(A4TODAY()>30,PastDue,OK)incellB4.

InEnglish,thisformulameans:IfthedateincellA4minustodaysdateisgreaterthan30days,thenenterthewordsPastDueincell
B4,else/otherwiseenterthewordOK.CopythisformulafromB4toB5throughB13.

(https://cmsimages.idgesg.net/images/article/2015/08/excel_logical_formulas_screen1
100610996orig.png)

UseanIFstatementtoflagpast-dueaccountssoyoucansendnoticestothose
customers.

Pass/Faillifeguardtest
TheOregonLifeguardCertificationisaPass/Failtestthatrequiresparticipantstomeetaminimumnumberofqualificationstopass.
Scoresoflessthan70percentfail,andthosescoresgreaterthanthat,pass.ColumnAliststheparticipantsnamescolumnBshows
theirscoresandcolumnCdisplayswhethertheypassedorfailedthecourse.TheinformationincolumnCisattainedbyusinganIF
statement.

Oncetheformulasareentered,youcancontinuetoreusethisspreadsheetforever.Justchangethenamesatthebeginningofeach
quarter,enterthenewgradesattheendofeachquarter,andExcelcalculatestheresults.
A.EnterthisformulaincellC4:=IF(B4<70,FAIL,PASS).ThismeansifthescoreinB4islessthan70,thenenterthewordFAILincell
B4,else/otherwiseenterthewordPASS.CopythisformulafromC4toC5throughC13.

(https://cmsimages.idgesg.net/images/article/2015/08/excel_logical_formulas_screen2
100610997orig.png)

UseanIFstatementtoconvertnumericscorestoapass-failstatus.

Sales&bonuscommissions
WilcoxIndustriespaysitssalesstaffa10percentcommissionforallsalesgreaterthan$10,000.Salesbelowthisamountdonotreceive
abonus.ThenamesofthesalesstaffarelistedincolumnA.EntereachpersonstotalmonthlysalesincolumnB.ColumnCmultiples
thetotalsalesby10percent,andcolumnDdisplaysthecommissionamountorthewordsNoBonus.Nowyoucanaddtheeligible
commissionsincolumnDandfindouthowmuchmoneywaspaidoutinbonusesforthemonthofAugust.

A.EnterthisformulaincellC4:=SUM(B4*10%),thencopyfromC4toC5throughC13.Thisformulacalculates10percentofeachpersons
sales.

B.EnterthisformulaincellD4:=IF(B4>10000,C4,Nobonus),thencopyfromD4toD5throughD13.Thisformulacopiesthe
percentagefromcolumnCforsalesgreaterthan$10,000orthewordsNoBonusforsaleslessthan$10,000intocolumnD.

C.EnterthisformulaincellD15:=SUM(D4:D13).Thisformulasumsthetotalbonusdollarsforthecurrentmonth.

(https://cmsimages.idgesg.net/images/article/2015/08/excel_logical_formulas_screen3
100610998orig.png)
UseanIFstatementtocalculatesalesbonuscommissions.

ConvertscorestogradeswithnestedIFstatements
ThisexampleusesanestedIFstatementtoconvertthenumericalMathscorestolettergrades.ThesyntaxforanestedIFstatementis
this:IFdataistrue,thendothisIFdataistrue,thendothisIFdataistrue,thendothisIFdataistrue,thendothiselse/otherwisedo
that.YoucannestuptosevenIFfunctions.

ThestudentsnamesarelistedincolumnAnumericalscoresinColumnBandthelettergradesincolumnC,whicharecalculatedbya
nestedIFstatement.

A.EnterthisformulaincellC4:=IF(B4>89,A,IF(B4>79,B,IF(B4>69,C,IF(B4>59,D,F)))),thencopyfromC4toC5throughC13.

Note:Everyopen,leftparenthesisinaformulamusthaveamatchingclosed,rightparenthesis.Ifyourformulareturnsanerror,count
yourparentheses.

(https://cmsimages.idgesg.net/images/article/2015/08/excel_logical_formulas_screen4
100610999orig.png)
UseanestedIFstatementtoconvertnumericscorestolettergrades.

DetermineslidingscalesalescommissionswithnestedIFstatements
ThislastexampleusesanothernestedIFstatementtocalculatemultiplecommissionpercentagesbasedonaslidingscale,thentotals
thecommissionsforthemonth.ThesyntaxforanestedIFstatementisthis:IFdataistrue,thendothisIFdataistrue,thendothisIF
dataistrue,thendothiselse/otherwisedothat.ThenamesofthesalesstaffarelistedincolumnAeachpersonstotalmonthlysales
areincolumnBandthecommissionsareincolumnC,whicharecalculatedbyanestedIFstatement,thentotaledatthebottomofthat
column(incellC15).

A.EnterthisformulaincellC4:=IF(B4<5000,B4*7%,IF(B4<8000,B4*10%,IF(B4<10000,B4*12.5%,B4*15%))),thencopyfromC4toC5
throughC13.

B.EnterthisformulaincellC15:=SUM(C4:C13).Thisformulasumsthetotalcommissiondollarsforthecurrentmonth.

(https://cmsimages.idgesg.net/images/article/2015/08/excel_logical_formulas_screen5
100611000orig.png)

UseanestedIFstatementtocalculatedifferentcommissionsbasedondifferent
percentages.

Calculateproductpricebasedonquantity
Manyretailersandmostwholesalersprovidecustomersapricebreakbasedonquantity.Forexample,awholesalermaysell1to10T
shirtsfor$10.50each,and11to25Tshirtsfor$8.75each.UsethefollowingIFstatementformulatodeterminehowmuchmoneyyou
cansavebypurchasingwholesaleproductsforyourcompanyinbulk.

1.EntertheheaderWholesalePricesincellA3.EntertheheadersQtyandCostincellsB3andC3.

2.EnterthequantitybreaksincellsB4throughB9.

3.EnterthepricebreaksincellsC4throughC9.

Thisisthequantity/pricematrixforyourwholesalebusiness.

(https://cmsimages.idgesg.net/images/article/2017/03/06calculateproductpricesbasedon
quantity100711899orig.png)
PCWorld/JDSartain

Calculateproductpricesbasedonquantity.

4.Next,entertheheadersQtyOrderedandQtyCostincellsB11andC11.

5.EntertheheaderWholesaleProductsincellA11,thenenterasmanyproductsasyoulikebelow.

6.EnterthequantityorderedforeachproductincolumnB.

7.Andlast,enterthefollowingformulaintheadjacentcellsofcolumnC:

=B12*IF(B12>=101,3.95,IF(B12>=76,5.25,IF(B12>=51,6.3,IF(B12>=26,7.25,IF(B12>=11,8,IF(B12>=1,8.5,))))))

Notetherearenospacesinthisformula.CopydowntheformulaasfarasneededincolumnCtoapplytoallthewholesaleproductsand
quantitiesincolumnsAandB.

8.Oncetheorderiscomplete,createatotalline:IncolumnA(inthiscase,A20),typeTOTALInvoiceAmount.IncolumnC(inthis
case,C20),usetheSUMfunctiontototalthecolumn.

Now,thatalltheformulasareinplace,allyouhavetodoeachweek(ormonth)isenterthenewquantitiesincolumnB,andExceldoes
therest.Ifthepriceschange,justmodifythematrixatthetopofthespreadsheet,andalltheotherformulasandtotalswillautomatically
adjust.

UsingotherfunctionsinsidetheIFstatement
Inthisexample,wellnesttwoIFstatementsandinserttheSUMfunctionallintothesameformula.Thepurposeistodeterminewhether
theindividualsgoalsarelessthan,equalto,orgreaterthanthecompanysmonthlycap.

1.EnteramonthlycapamountinB1,whichcanbechangedeverymonthtoreflectthecompanysexpectations.

2.EnterthefollowingheadersincellsA3throughG3:Goals,1stQtr,2ndQtr,3dQtr,4thQtr,GoalsorCap?,andBonus.

3.Enterthetopfivemarketingpersons'goalamountsincellsA4throughA8.

4.Enterthesameindividuals'quarterlytotalsincellsB4throughE8.

(https://cmsimages.idgesg.net/images/article/2017/03/07usingotherfunctionsinsidetheif
statement100711897orig.png)
PCWorld/JDSartain

UsingotherfunctionsINSIDEtheIfStatement

Foremployeeswhoachievedtheirgoals,thebonusis10%ofthegoalamount.Foremployeeswhoexceededthemonthlycap,the
bonusis25%oftheiractualsales.Usetheseformulastodeterminethebonusamounts.

5.EnterthisformulaincellsF4throughF8:=IF(A4<=B1,A4,IF(A4>B1,SUM(B4:E4,0)))

6.EnterthisformulaincellsG4throughG8:=IF(F4<=A4,F4*10%,IF(F4>=B1,F4*25%,0))

UseIFtoavoiddividingbyzero
InExcel,ifyoutrytodivideanynumberbyzero,theerrormessagethatExceldisplaysisthis:#DIV/0!

So,whattodoifyouhavealargedatabasethatrequiresacalculationbasedondivision,andsomeofthecellscontainzeros?Usethe
followingIFstatementformulatoaddressthisproblem.

1.TotrackthemoneycollectedpermonthbythestaffatFriarTucksFundraisers,openaspreadsheetandcreatethefollowingheaders:
DollarsinA1,DollarsperWorkerinB1,DollarsLeftOverinC1.

2.EntersomedollaramountsincolumnAandthenumberofstaffworkingperdayincolumnB.ColumnBwillincludesomezeroes
because,somedays,nobodyworks(butdonationsstillcomeinthroughthemail).

2.EnterthisformulainC2throughC11:=IF(B2<>0,A2/B2,0).ByusinganIFstatementtopreventExcelfromdividinganyofthefunds
collectedbyzero,onlythevalidnumbersarecalculated.

(https://cmsimages.idgesg.net/images/article/2017/03/08useiftoavoiderrorsfromdividing
byzero100711898orig.png) PCWorld/JDSartain
08UseIFtoavoiderrorsfromdividingbyzero

3.YoucoulduseanotherIFstatementtolocatethezeroesincolumnB,thentotalthecorrespondingdollarsincolumnA,whichwould
thenbedividedequallyamongallthestaff.CopythisformulainD2throughD11:=IF(B4=0,A4,0).

4.Next,moveyourcursortoB12andenterthisformula=MAX(B2:B11)tolocatethelargestnumberofworkersincolumnB,whichis
eight.

5.MoveyourcursortoD12andenterthisformula:=SUM(D2:D11)/B12.Theansweris$392.50foreachoftheeightstaffmembers
workingatFriarTucksFundraisers.

Editor'snote:ThisarticlewasupdatedfromitsoriginalpostingonSeptember8,2015.

TocommentonthisarticleandotherPCWorldcontent,visitourFacebook(https://www.facebook.com/PCWorld/)pageorourTwitter
(https://twitter.com/pcworld)feed.

Related: Productivity(/Category/Software-Productivity) Software(/Category/Software) Excel(/Tag/Excel/)


MicrosoftOffice(/Tag/Microsoftoffice/)

JDSartainisatechnologyjournalistfromBoston.

Follow
(/author/JD
(https://twitter.com/jdsartain)
Sartain/)

YOUMIGHTLIKE AdsbyRevcontent

Hitler'sDeathbed GetOfficialTicketsfor TheUltimateCheap DiabetesBreakthrough WatchHowThisSimple


Confession.Brave the72Million FlightsFinder! ThatWillBankrupt MethodCan"Regrow"
ResearchersUncover Eurojackpotin Save70.com DiabetesIndustry YourHearNaturally.Try
ShockingNew Bangladesh (//trends.revcontent.com/click.php?
godiabetesfree.org Tonight
Information TheLotter RegrowHairProtocol
d=lb4FSmTHFVcB2Q50wnE8%2F3DOvIJDl%2BsJB%2FiduFDcCafQOpSsCA1UGKk1FfxcNRu%2F33jNU
(//trends.revcontent.com/click.php?
NaturalHealthResponse
(//trends.revcontent.com/click.php? (//trends.revcontent.com/click.php?
d=D%2FIznOBq2MoZ06L22mHU%2FcRiqcPn7ShMVVQ4RiAVDwxN5AvH
d=Vwgs0tDa3nn6ks6vhg8sKkGD1eV2Gh8nKph1SBa9cDF2mardKZJGrCEp7em%2BQ9aZUB4Zn2x8TnHnm2GV%2FPNlgN9xu4ZYlZycYLh
(//trends.revcontent.com/click.php? d=QMFGnAe2c0FvUaYCmySHtOW%2
d=QG2NCVghsY00d6xKePxo%2Bt%2Bg%2BkDAehoHgjFQxevFPIfBQaDBre3soSyxxdCe1CzzmmVBWN3a3VQVKuATd9hbibL1hAxgKUJdZq4BhiCG06wBWVWabFrVZUqJ5

TheUltimateHotel HowWindowsExplorer Senatevotestokill Howtotransformyour GetOfficialTicketsfor


Finder! canhelpyoufind FCC'sbroadbandprivacy smartphoneintoareal- the$174MillionUS
Save70.com duplicatefiles rules worldStarTrek MegaMillionsin
(//trends.revcontent.com/click.php? (//trends.revcontent.com/click.php?
tricorder Bangladesh!
(//trends.revcontent.com/click.php? TheLotter
d=9XA4H%2BBBtGMyyOsqES1SVA%2B9zQvqcLhpiG1GK53ApkfeqHqu1dAFt38WB3awzBL5PYkXqnAihdBuma%2BiJu6iPn5aTooSvaoe0dEdwORUZonNL%2F7vMJK86jKV
d=pfWe7Htu%2Bhi%2F7Fs0VMSvim0yvFwjz3ZjVpSpQ8tLnmI79OQ2uHdU9lrY7TJnor8VWdh7qxfukUF3QZ
d=MoER%2Faa2tSkS5jNLO6FIhJjx6tQzvTgQZEM9sExTC5vnRy9rpLAuesscdwc2FCqS8Xq1%2BOyZj%2Bkm8jnsMEneZ%2B5PTscg0E41%
(//trends.revcontent.com/click.php?
(//trends.revcontent.com/click.php?
d=xE4ueeTAsiGzeum0clFta7CiecUIoksohBumebJOaAO2pXIa%2BtpbBx3
d=oD3WOsVVLfiXShLaEh1CADMjnfIWq
SHOPTECHPRODUCTSATAMAZON

1. FriarTuck'sTalesForTheCommonOutlaw(http://aaxuseast.amazonadsystem.com/x/c/QtKKZ55uC3640lr_nI9Up6wAAAFbPlLTGwEAAAFKAdHeZAA/https://www.amazon.com/FriarTucksTale
CommonOutlaw/dp/0615571433/ref=sm_n_au_dka_BD_pr_con?
sigts=1491399267119&sig=7db9fd60bfda9e9e28a46e3ab9ae835ad1866c70&adId=0615571433&creativeASIN=0615571433&linkId=0a44942548709067b465962ae2c390bb&tag=httpwwwidgcsm_pcw
20&linkCode=w51&refrefURL=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftwareproductivity%2Fexcellogicalformulas5simpleifstatementstoget
started.html&slotNum=0&imprToken=pvWrheV3i6MZsjyysNZeiQ) $12.99
2. EnfamilInfantBabyFormula33.2ozRefillBox(http://aaxuseast.amazonadsystem.com/x/c/QtKKZ55uC3640lr_nI9Up6wAAAFbPlLTGwEAAAFKAdHeZAA/https://www.amazon.com/EnfamilInf
FormulaRefill/dp/B003VKWMJI/ref=sm_n_au_dka_BD_pr_con?
sigts=1491399267119&sig=2172a697e52a120b01dbf484e217a34bae019bbc&adId=B003VKWMJI&creativeASIN=B003VKWMJI&linkId=0a44942548709067b465962ae2c390bb&tag=httpwwwidgcsm
20&linkCode=w51&refrefURL=http%3A%2F%2Fwww.pcworld.com%2Farticle%2F2971613%2Fsoftwareproductivity%2Fexcellogicalformulas5simpleifstatementstoget
started.html&slotNum=0&imprToken=pvWrheV3i6MZsjyysNZeiQ) $36.98
3. SimilacAdvanceInfantFormulawithIron,Stage1Powder,23.2Ounces(Packof6)(http://aaxuseast.amazon

Vous aimerez peut-être aussi