LeanExcel:TopFunctions
ByScottRatliff
www.LeanExcelBooks.com
LegalStuff
Copyright©2015byScottRatliff
Allrightsreserved.Nopartofthisebookmaybereproducedortransmittedinanyform
orbyanymeanswithoutwrittenpermissionfromthepublisher.
Allbrandnamesandproductnamesusedinthisbookaretradenames,servicemarks,
trademarks,orregisteredtrademarksoftheirrespectiveowners.ScottRatliffisnot
associatedwithanyproductorvendormentionedinthisbook.
Introduction
Knowinghowtousethebuilt-infunctionsinMicrosoftExcelwillturnyouintoa
poweruser!Therearehundredsoffunctionsandatfirst,thelistcanseemoverwhelming.
EvenasaMicrosoftOfficeExpertinExcel2013IdonotknowalloftheExcelfunctions
available.InwritingthiseBook,IdiscoveredseveralnewfunctionsthatIhavenow
incorporatedintomydailyuseandhavemademydataanalysismoreefficient.Ihopethat
thiseBookwillhelpyoulearnmoreoftheExcelfunctionsandthattheywouldhelpyou
gaincontroloveryourspreadsheets!
WhyLeanExcel?
ThisLeanExcelseriesfocusesontime-savingtoolsthatwillhelpyoureducethe
wasteassociatedwithdataanalysis.Oneofthetenetsofleanmanufacturingtheoryis
usingspecializedtoolstoaccomplishatask.Youcoulduseawrenchtodriveanailbuta
hammerwillgetthejobdonemuchfaster.Remembertimeismoney.
Thinkofthebuilt-infunctionsasspecializedtools.Let’ssayyouneededtofindthe
averageofadatasetthatisinA1throughA5.Remembertheaverageisthesumofallthe
numbersinadatasetdividedbythecountofnumbersinthatdataset.Let’slookatthree
waystofindtheaverage.First,youcouldusetheformula=(A1+A2+A3+A4+A5)/5.
Second,youcouldusetheSUMandCOUNTfunctions=SUM(A1:A5)/COUNT(A1:A5).
Orlastly,youcouldusetheAVERAGEfunction=AVERAGE(A1:A5).Althoughallthree
optionsgiveyouthesameanswer,usingtheAVERAGEfunctionisclearlythemost
efficient.ButinordertousetheAVERGEfunction,youneedtoknowthatitexistsand
whatrequirementsyouneedtouseit.
EnteringFormulasandFunctions
First,let’sidentifythesimilaritiesbetweenformulasandfunctions.Bothformulas
andfunctionscanbeenteredusingtheformulabarimmediatelybelowtheExcelRibbon.
TheExcelRibbonisthehorizontalbarnearthetopoftheExcelwindowthatcontainsall
ofthebuttonsfortoolsavailableinExcel.Bothformulasandfunctionsbeginwiththe
equalssign(=).Thisisrequiredonlyatthebeginningoftheformulabar;itisnotrequired
beforeeachindividualfunctionwithinthatcell.TheequalssigntellsExcelthatyouwant
Exceltodoacalculationforthiscell.Ifyoudidnothavetheequalssign,thenExcelwill
putexactlywhatyoutypeintothatcell.
Next,let’sidentifythedifferencebetweenafunctionandaformula.Inthefirst
sectionofthisbook,wediscussed3waystofindtheaverageoffivenumbers.Thefirst
optionisanexampleofaformula.Itbeginswithanequalssign(=)andincludes
mathematicoperators(addition:+,subtraction:-,multiplication:*,division:/).Asseenin
thefirstoption=(A1+A2+A3+A4+A5)/5,itcanincludebothreferencestocells(A1,A2,
A3,etc.)andactualnumbers(the5afterthedivisionsign).Aformulacanincludeother
mathematicoperatorssuchasparentheses()todeterminetheorderofoperationsand^for
exponents.Excelfollowsthesameorderofoperationsyoulearnedinalgebra:
Parenthesesthenexponentsthenmultiplicationanddivisionandlastlyadditionand
subtraction.Soifyouentered=(2+3)^2/5+1intoacellinExcel,itwouldfirstdowhat
wasintheparentheses(2+3)=5.Nextitwouldlookforexponentsso(5)^2=25.Thenit
wouldlookformultiplicationordivision25/5=5andlastlyadditionorsubtraction5+1=
6.So6wouldbetheresultoftheformulaandbedisplayedinthecell.
Afunctionisenteredverysimilarlybutusesabuilt-inkeywordthatExcelwill
recognize.ThethirdoptionfromtheprevioussectionusestheAVERAGEfunction.To
enterthefunction,firstputanequalssign(=)thentypethefunctionname.Excelwilltry
torecognizethekeywordyouaretypingandprovideyoualistofthefunctionsthatbegin
withwhatyoutyped.Youcaneithercontinuetypingordouble-clickonthefunctionyou
seeinthelist.Whenyoutypethekeyword,uppercaseisnotrequired;however,ifExcel
identifiesthekeywordasafunction,thenitwillconvertittouppercase.Alternatively,
youcouldclickontheFormulatabontheExcelribbonandchooseafunctionfromthe
categorieslistedthere.Forreferenceconsistency,thefunctionsincludedinthiseBookare
dividedtomatchthecategoriesontheFormulastaboftheExcelribbon.
Eachfunctionbeginswiththeequalssign(=)thenthekeyword(AVERAGE,
COUNT,SUM,etc.)andthenanopenparentheses(.Aftertheopenparentheses,Excel
expectsalistofarguments.Thisisthemostconfusingpartofusingafunction.Each
functionrequiresadifferentsetofargumentsandtheargumentsmustmatchcertain
criteriaorthefunctionwillreturnanerror(#ERR,#N/A,#DIV/0,etc.).Inthethirdoption
above,theAVERAGEfunctionrequiredsomenumber,listofnumbers,orrangeasan
argument.WeenteredtherangeA1:A5fortheargument.Weassumedthatrange
containedvalidnumberdata,ifanycellinthatrangeA1:A5containedsomethingbesides
anumber,thenourfunctionmayhaveresultedinanerror.
Youcanalsouseformulasandfunctionstogether.Forexample,thesecondoptionof
theprevioussectionistwofunctions(SUMandCOUNT)inaformula(SUM/COUNT).
Wecoulduseanyofthemathematicoperatorsontheresultofanyfunctionaslongasthe
resultofthatfunctionisanumber.Somefunctionsreturnnon-numericdatasothatmay
resultinanerror.
FunctionArguments
Afewmoredetailsweneedtodiscussbeforewegettothefunctions.Intheprevious
section,wediscussedhowafunctionbeginswithanequalssignthenakeyword,thenan
openparentheses,thenthearguments,andlastlytheclosingparentheses.Somefunctions
suchasTODAY()requiresnoarguments.OtherargumentssuchasSUM,COUNT,
AVERAGErequireoneargumentbutthenallowformanymorearguments.Whenyou
enterafunction,excelshowsyouwhichargumentyouarecurrentlyenteringwiththepopupboxthatappearsbelowtheformulabar.Forexample,fortheSUMfunction,thepopupboxdisplaysSUM(number1,[number2],…).Thenumber1meansitisrequiredbutthe
brackets[]aroundthe[number2]indicateitisoptional.Notethecommaseparatingthe
arguments;whenyouenterafunction,youwillneedtoseparatetheargumentsbya
commatoo.The(…)meansthattherecouldbemanymoreargumentsthatmatchthetype
ofthelastargument.Inthiscase,therecouldbemanymorenumbers([number3],
[number4],etc).
Somefunctionshaveanoptionalpairofarguments.Forexample,theSUMIFS,
COUNTIFS,andAVERAGEIFSfunctionsallhavethearguments[criteria_rangeX,
criteriaX]whereXisthenextnumberinseries.Sincethebracketisaroundthepairor
arguments,thepairisoptionalbutifyouwanttoincludetheargument,thenyoumust
includebothargumentsofthepair.
Mostargumentscouldbefulfilledbyeitheravalueoracellreference.Most
experiencedExcelusersputalloftheargumentsincellsandthenreferencethecells
withintheargumentsofthefunction.Theexampleworkbooksarebuiltthisway.With
thismethod,youcanchangethevalueinthereferencecellsandthefunctionwillthen
changeinsteadofhavingtogointotheformulabarandchangethefunctiondirectly.I
hopeusingthismethodwillhelpyouunderstandtherelationshipbetweentheinputsand
outputsofthefunctionasbothcomponentsarevisible.
ExampleWorkbook
Toreallyunderstandatopic,mostpeopleneedtovisualizeit.Therefore,allofthe
functionsdiscussedinthiseBookareincludedinaworkbookwithover500examples.
YoucanfindtheexampleworkbookandVisualAidprintoutsatthelinkbelow.
Tohelpvisualizetheinputs,somefunctionsthatrequirearangehavetherange
addresssavedinacell.Theninthefunction,I’veaddedtheINDIRECTfunctionto
converttherangeaddresssavedinthecelltotheactualrangeofthefunction.For
example,let’ssayB5containstherangeaddress“A2:A4”andA2throughA4containsall
numbers.IfIwastoenterthefunction=SUM(B5),itwouldreturn0becauseB5contains
thetextstring“A2:A4”.Inordertoconvertthetext“A2:A4”intoanaddress,weneedto
addtheINDIRECTfunction.Sothefunctionshouldthenbe=SUM(INDIRECT(B5))
whichisequivalentto=SUM(A2:A4)sinceB5contains“A2:A4”.Theexamplesareset
upthiswaysoyoucanseetheaddressoftherangesthatgointothefunctions.Tochange
theaddress,changeitinthecellwiththeaddress(inthemostrecentexample,thatcell
wouldbeB5).
Findtheexampleworkbookhere:
/>
FunctionGuide
ThisFunctionGuideliststhekeywordthentheargumentsanddescriptionforeach
function.Wheneverthedescriptionreferencesthearguments,theargumentnamewillbe
inbold.Mostdescriptionswillbeginwiththeword“returns.”Theargumentsarethe
inputofthefunctionandthenthefunctionreturnstheoutput.Theoutputisvisibleinthe
cellwhilethefunctionisstillvisibleintheformulabarorbydoubleclickinginthecell.
Somefunctionsinthefunctionguidemustbeenteredasanarray.Toenterafunction
asanarray,holddownthecontrolandshiftbuttonswhilepressingenter(formacusers,
holddowncontrolandshiftwhilepressingreturn).Youwillknowthefunctionwas
enteredasanarraybythecurlybrackets{}aroundthefunctionintheformulabar.Donot
enterthecurlybracketsmanually.
DateFunctions
UsingDatesinExcel
Excelstoresdatesasnumberscalledserialnumbers.Zerocorrespondsto1/1/1904.
Thenumber100refersto100dayssince1/1/1904.Timesarestoredaspartialdays.So
12:00noonishalfthedaysoitisstoredas0.5addedtothedate.
AddingandSubtractingDatesandTimes
Toaddorsubtractadate,justaddorsubtractwholenumbers.Toaddorsubtracta
time,addorsubtractthepartialday.Ifyouwantedtoseewhattimeitwasafter5hours,it
iseasierandmoreexacttoadd5/24toadatethanitistorememberthat5/24=
.208333333.
DATE
Arguments:year,month,day
Description:Returnstheserialnumberofthedateofthespecifiedyear,month,andday.
DAY
Arguments:serial_number
Description:Returnsthedayofthemonth(1-31)oftheserial_number.
DAYS
Arguments:end_date,start_date
Description:Returnsthenumberofdaysbetweenend_dateandstart_date.Equivalentto
end_date-start_date.
EDATE
Arguments:start_date,months
Description:Returnstheserialnumberofthedatethatisthespecifiednumberofmonths
beforeorafterthestart_date.Ifmonthsislessthan0thenitreturnsmonthsbefore;if
greaterthan0thenmonthsafter.
EOMONTH
Arguments:start_date,months
Description:Returnstheserialnumberofthelastdayofthemonththatisthespecified
numberofmonthsbeforeorafterthestart_date.Ifmonthsislessthan0thenitreturns
monthsbefore;ifgreaterthan0thenmonthsafter.
HOUR
Arguments:serial_number
Description:Returnsthehour(0-23)oftheserial_number.
MINUTE
Arguments:serial_number
Description:Returnstheminute(0-59)oftheserial_number.
MONTH
Arguments:serial_number
Description:Returnsthemonth(1-12)oftheserial_number.
NETWORKDAYS
Arguments:start_date,end_date,[holidays]
Description:Returnsthenumberoffullworkdaysbetweenstart_dateandend_date.
Specifythedatesofanyholidaystoexclude.
NOW
Arguments:none
Description:Returnsthecomputer’sdateandtime.