2010 Excel Functions Macros And Data Commands Manual As Of March
User Manual:
Open the PDF directly: View PDF .
Page Count: 108 [warning: Documents this large are best viewed by clicking the View PDF Link!]
MicrosoftExcel
Functions,Macros&
DataCommands
J.CarltonCollins,CPA
ASAResearch
Atlanta,Georgia
770.734.0950
Carlton@ASAResearch.com
A
SA Research
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage2CopyrightMay2010
TableofContents
Chapter1–ExcelFunctions..........................................................................4
Chapter2–TheIfFunction.........................................................................18
Chapter3–UsingFunctionstoClean&CrunchData.................................23
Chapter4–DataCommands......................................................................41
Chapter5‐Macros.....................................................................................76
Chapter6–Miscellaneous.........................................................................81
Chapter7–XMLData.................................................................................84
Chapter8–QuickTips................................................................................92
Chapter9–What’sNewinExcel2007.......................................................95
Chapter10–What’snewinExcel2010....................................................104
Appendix‐Instructor’sBiography............................................................108
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage3CopyrightMay2010
ExcelFunctions,Macros&DataCommands
CourseInformation
LearningObjectives ToincreasetheproductivityofaccountantsandCPAs
usingExcel’sfunctions,macros,&datacommands
CourseLevel Intermediate
Pre‐Requisites GoodFamiliaritywithMicrosoftExcel
AdvancedPreparation None
PresentationMethod Livelectureusingfullcolorprojectionsystemsand
liveInternetaccesswithfollowupcoursematerials
RecommendedCPECredit 8hours
Handouts Templates,checklists,webexamples,manual
Instructors J.CarltonCollins,CPA
AdvisorCPEisregisteredwiththeNationalAssociationof
StateBoardsofAccountancy(NASBA)asasponsorof
continuingprofessionaleducationontheNational
RegistryofCPESponsors.Stateboardsofaccountancy
havefinalauthorityontheacceptanceofindividual
coursesforCPEcredit.Complaintsregardingregistered
sponsorsmaybeaddressedtothenationalRegistryof
CPESponsors,150FourthAvenue,Nashville,TN,37219‐
2417.Telephone:615‐880‐4200.
Copyright©May2010,AdvisorCPEandAccountingSoftwareAdvisor,LLC
4480MissendellLane,Norcross,Georgia30092770.734.0450
Allrightsreserved.Nopartofthispublicationmaybereproducedortransmittedinanyformwithouttheexpress
writtenconsentofAdvisorCPEorASAResearch,subsidiariesofAccountingSoftwareAdvisor,LLC.Requestmaybe
e‐mailedtomarylou@advisorcpe.comorfurtherinformationcanbeobtainedbycalling770.734.0450orby
accessingtheAdvisorCPEhomepageat:http://www.advisorcpe.com/
Alltradenamesandtrademarksusedinthesematerialsarethepropertyoftheirrespectivemanufacturersand/or
owners.Theuseoftradenamesandtrademarksusedinthesematerialsarenotintendedtoconveyendorsement
ofanyotheraffiliationswiththesematerials.Anyabbreviationsusedhereinaresolelyforthereader’s
convenienceandarenotintendedtocompromiseanytrademarks.Someofthefeaturesdiscussedwithinthis
manualapplyonlytocertainversionsofExcel,andfromtimetotime,Microsoftmightremovesomefunctionality.
MicrosoftExcelisknowntocontainnumeroussoftwarebugswhichmaypreventthesuccessfuluseofsome
featuresinsomecases.AdvisorCPEmakesnorepresentationsorwarrantywithrespecttothecontentsofthese
materialsanddisclaimsanyimpliedwarrantiesofmerchantabilityoffitnessforanyparticularuse.Thecontentsof
thesematerialsaresubjecttochangewithoutnotice.
ContactInformation:
J.CarltonCollins
carlton@asaresearch.com
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage4CopyrightMay2010
Chapter1
ExcelFunctions
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage5CopyrightMay2010
IntroductiontoExcelFunctions
ExcelFunctionsarepreprogrammedformulasthatmakethetaskofwritingcomplexformulas
easier.Thereareatotalof333functionsinExcel.Thesefunctionsareseparatedinto11
categoriesasfollows:
Categories&NumberOfFunctionsInEachCategory
1. DatabaseFunctions(12)
2. DateandTimeFunctions(20)
3. EngineeringFunctions(39)
4. FinancialFunctions(53)
5. InformationFunctions(17)
6. LogicalFunctions(6)
7. LookupandReferenceFunctions(18)
8. MathandTrigonometryFunctions(59)
9. StatisticalFunctions(80)
10. TextFunctions(27)
11. ExternalFunctions(2)
RelevancetoCPAs‐SomeExcelfunctionsaremorepowerfulthanothersandsomearemore
relevanttotheCPAthanothers.Forexample,mostCPAswillfindtheIF,SUM,COUNT,
SUBTOTAL,TEXT,andVLOOKUPareveryrelevanttotheCPAwhileotherengineeringand
trigonometryfunctionssuchasLOG,PI,RADIENS,DELTA,TAN,COMPLEX,andHAX2DECare
typicallylessrelevanttoCPAs.Ithasbeenmyexperiencethatthefollowing75functionsare
mostrelevanttotheCPA;thereforeinmyopinion,CPAswishingtoincreasetheircommandof
Excelfunctionsshouldconcentrateonthesefunctionsfirst.
Carlton’sListofTheTop75FunctionsMostRelevanttoCPAs
(SortedByCarlton’sOpinionofUsefulness)
OpenanExcelfileContainingFunctionExamples:
http://www.ASAResearch.com/web/functions.xlsx
1. IF‐Specifiesalogicaltesttoperform
2. SUM‐Addsitsarguments
3. SUBTOTAL‐Returnsasubtotalinalistordatabase
4. SUMIF‐Addsthecellsspecifiedbyagivencriteria
5. COUNT‐Countshowmanynumbersareinthelistofarguments
6. COUNTA‐Countshowmanyvaluesareinthelistofarguments
7. AVERAGE‐Returnstheaverageofarangeofnumbers
8. COUNTBLANK‐Countsthenumberofblankcellswithinarange
9. COUNTIF‐Countsthenumberofnonblankcellswithinarangethatmeetthegivencriteria
10. VALUE‐Convertstexttoanumber
11. TEXT‐Formatsanumberandconvertsittotext
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage6CopyrightMay2010
12. VLOOKUP‐Looksinthefirstcolumnofanarrayandmovesacrosstherowtoreturnthevalueof
acell
13. HLOOKUP‐Looksinthetoprowofanarrayandreturnsthevalueoftheindicatedcell
14. TWOWAYLOOKUP–UsingbothVLOOKUPandHLOOKUPtogether
15. LOOKUP‐Looksupvaluesinavectororarray
16. MATCH‐Looksupvaluesinareferenceorarray
17. TRIM‐Removesspacesfromtext
18. PROPER‐Capitalizesthefirstletterineachwordofatextvalue
19. LOWER‐Convertstexttolowercase
20. UPPER‐Convertstexttouppercase
21. LEFT‐Returnstheleftmostcharactersfromatextvalue
22. RIGHT‐Returnstherightmostcharactersfromatextvalue
23. MID‐Returnsaspecificnumberofcharactersfromatextstringstartingatthepositionyou
specify
24. FIND‐Findsonetextvaluewithinanother(case‐sensitive)
25. SUBSTITUTE‐Substitutesnewtextforoldtextinatextstring
26. LEN‐Returnsthenumberofcharactersinatextstring
27. REPLACE‐Replacestextinastringwithalternativetext
28. CONCATENATE‐Joinsseveraltextitemsintoonetextitem
29. CLEAN‐Removesallnonprintablecharactersfromtext
30. NOW‐Returnstheserialnumberofthecurrentdateandtime
31. TODAY‐Returnstheserialnumberoftoday'sdate
32. DATE‐Returnstheserialnumberofaparticulardate
33. MONTH‐Convertsaserialnumbertoamonth
34. DAY‐Convertsaserialnumbertoadayofthemonth
35. YEAR‐Convertsaserialnumbertoayear
36. WEEKDAY‐Convertsaserialnumbertoadayoftheweek
37. ROUND‐Roundsanumbertoaspecifiednumberofdigits
38. ROUNDDOWN‐Roundsanumberdown,towardzero
39. ROUNDUP‐Roundsanumberup,awayfromzero
40. MAX‐Returnsthemaximumvalueinalistofarguments
41. DMAX‐Returnsthemaximumvaluefromatablearraybasedonalistofarguments
42. MIN‐Returnstheminimumvalueinalistofarguments
43. DMIN‐Returnstheminimumvaluefromatablearraybasedonalistofarguments
44. MEDIAN‐Returnsthemedianofthegivennumbers
45. MODE‐Returnsthemostcommonvalueinadataset
46. PERCENTILE‐Returnsthek‐thpercentileofvaluesinarange
47. PERCENTRANK‐Returnsthepercentagerankofavalueinadataset
48. PMT‐Returnstheperiodicpaymentforanannuity
49. NPV‐Returnsthenetpresentvalueofaninvestmentbasedonaseriesofperiodiccashflows
andadiscountrate
50. DSUM‐Addsthenumbersinthefieldcolumnofrecordsinthedatabasethatmatchthecriteria
51. DCOUNT‐Countsthecellsthatcontainnumbersinadatabase
52. DCOUNTA‐Countsnonblankcellsinadatabase
53. AND‐ReturnsTRUEifallofitsargumentsareTRUE
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage7CopyrightMay2010
54. OR‐ReturnsTRUEifanyargumentisTRUE
55. CHOOSE‐Choosesavaluefromalistofvalues
56. TIME‐Returnstheserialnumberofaparticulartime
57. FV‐Returnsthefuturevalueofaninvestment
58. IRR‐Returnstheinternalrateofreturnforaseriesofcashflows
59. YIELD‐Returnstheyieldonasecuritythatpaysperiodicinterest
60. CELL‐Returnsinformationabouttheformatting,location,orcontentsofacell
61. INFO‐Returnsinformationaboutthecurrentoperatingenvironment
62. ERROR.TYPE‐Returnsanumbercorrespondingtoanerrortype
63. ISBLANK‐ReturnsTRUEifthevalueisblank
64. ISNA‐ReturnsTRUEifthevalueisthe#N/Aerrorvalue
65. GETPIVOTDATA‐ReturnsdatastoredinaPivotTable
66. HYPERLINK‐Createsashortcutorjumpthatopensadocumentstoredonanetworkserver,an
intranet,ortheInternet
67. TRANSPOSE‐Returnsthetransposeofanarray
68. ABS‐Returnstheabsolutevalueofanumber
69. RAND‐Returnsarandomnumberbetween0and1
70. RANDBETWEEN‐Returnsarandomnumberbetweenthenumbersyouspecify
71. REPT‐Repeatstextagivennumberoftimes
72. SLN‐Returnsthestraight‐linedepreciationofanassetforoneperiod
73. SYD‐Returnsthesum‐of‐years'digitsdepreciationofanassetforaspecifiedperiod
74. DDB‐Returnsthedoubledecliningbalancedepreciationofanassetforaspecifiedperiod
75. DGET‐Extractsfromadatabaseasinglerecordthatmatchesthespecifiedcriteria
'J.CarltonCollins,CPA‐Copyright,January2007,carlton@asaresearch.com
All333ExcelFunctions
OrganizedByCategory,IncludingADescriptionOfEachFunction
DatabaseFunctions
FunctionDescription
1DAVERAGEReturnstheaverageofselecteddatabaseentries
2DCOUNTCountsthecellsthatcontainnumbersinadatabase
3DCOUNTACountsnonblankcellsinadatabase
4DGETExtractsfromadatabaseasinglerecordthatmatchesthespecifiedcriteria
5DMAXReturnsthemaximumvaluefromselecteddatabaseentries
6DMINReturnstheminimumvaluefromselecteddatabaseentries
7DPRODUCTMultipliesthevaluesinaparticularfieldofrecordsthatmatchthecriteriain
adatabase
8DSTDEVEstimatesthestandarddeviationbasedonasampleofselecteddatabase
entries
9DSTDEVPCalculatesthestandarddeviationbasedontheentirepopulationofselected
databaseentries
10DSUMAddsthenumbersinthefieldcolumnofrecordsinthedatabasethatmatch
thecriteria
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage8CopyrightMay2010
11DVAREstimatesvariancebasedonasamplefromselecteddatabaseentries
12DVARPCalculatesvariancebasedontheentirepopulationofselecteddatabase
entries
DateandTimeFunctions
FunctionDescription
13DATEReturnstheserialnumberofaparticulardate
14DATEVALUEConvertsadateintheformoftexttoaserialnumber
15DAYConvertsaserialnumbertoadayofthemonth
16DAYS360Calculatesthenumberofdaysbetweentwodatesbasedona360‐dayyear
17EDATEReturnstheserialnumberofthedatethatistheindicatednumberofmonths
beforeorafterthestartdate
18EOMONTHReturnstheserialnumberofthelastdayofthemonthbeforeoraftera
specifiednumberofmonths
19HOURConvertsaserialnumbertoanhour
20MINUTEConvertsaserialnumbertoaminute
21MONTHConvertsaserialnumbertoamonth
22NETWORKDAYSReturnsthenumberofwholeworkdaysbetweentwodates
23NOWReturnstheserialnumberofthecurrentdateandtime
24SECONDConvertsaserialnumbertoasecond
25TIMEReturnstheserialnumberofaparticulartime
26TIMEVALUEConvertsatimeintheformoftexttoaserialnumber
27TODAYReturnstheserialnumberoftoday'sdate
28WEEKDAYConvertsaserialnumbertoadayoftheweek
29WEEKNUMConvertsaserialnumbertoanumberrepresentingwheretheweekfalls
numericallywithayear
30WORKDAYReturnstheserialnumberofthedatebeforeorafteraspecifiednumberof
workdays
31YEARConvertsaserialnumbertoayear
32YEARFRACReturnstheyearfractionrepresentingthenumberofwholedaysbetween
start_dateandend_date
EngineeringFunctions
FunctionDescription
33BESSELIReturnsthemodifiedBesselFunctionIn(x)
34BESSELJReturnstheBesselFunctionJn(x)
35BESSELKReturnsthemodifiedBesselFunctionKn(x)
36BESSELYReturnstheBesselFunctionYn(x)
37BIN2DECConvertsabinarynumbertodecimal
38BIN2HEXConvertsabinarynumbertohexadecimal
39BIN2OCTConvertsabinarynumbertooctal
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage9CopyrightMay2010
40COMPLEXConvertsrealandimaginarycoefficientsintoacomplexnumber
41CONVERTConvertsanumberfromonemeasurementsystemtoanother
42DEC2BINConvertsadecimalnumbertobinary
43DEC2HEXConvertsadecimalnumbertohexadecimal
44DEC2OCTConvertsadecimalnumbertooctal
45DELTATestswhethertwovaluesareequal
46ERFReturnstheerrorFunction
47ERFCReturnsthecomplementaryerrorFunction
48GESTEPTestswhetheranumberisgreaterthanathresholdvalue
49HEX2BINConvertsahexadecimalnumbertobinary
50HEX2DECConvertsahexadecimalnumbertodecimal
51HEX2OCTConvertsahexadecimalnumbertooctal
52IMABSReturnstheabsolutevalue(modulus)ofacomplexnumber
53IMAGINARYReturnstheimaginarycoefficientofacomplexnumber
54IMARGUMENTReturnstheargumenttheta,anangleexpressedinradians
55IMCONJUGATEReturnsthecomplexconjugateofacomplexnumber
56IMCOSReturnsthecosineofacomplexnumber
57IMDIVReturnsthequotientoftwocomplexnumbers
58IMEXPReturnstheexponentialofacomplexnumber
59IMLNReturnsthenaturallogarithmofacomplexnumber
60IMLOG10Returnsthebase‐10logarithmofacomplexnumber
61IMLOG2Returnsthebase‐2logarithmofacomplexnumber
62IMPOWERReturnsacomplexnumberraisedtoanintegerpower
63IMPRODUCTReturnstheproductoffrom2to29complexnumbers
64IMREALReturnstherealcoefficientofacomplexnumber
65IMSINReturnsthesineofacomplexnumber
66IMSQRTReturnsthesquarerootofacomplexnumber
67IMSUBReturnsthedifferencebetweentwocomplexnumbers
68IMSUMReturnsthesumofcomplexnumbers
69OCT2BINConvertsanoctalnumbertobinary
70OCT2DECConvertsanoctalnumbertodecimal
71OCT2HEXConvertsanoctalnumbertohexadecimal
FinancialFunctions
FunctionDescription
72ACCRINTReturnstheaccruedinterestforasecuritythatpaysperiodicinterest
73ACCRINTMReturnstheaccruedinterestforasecuritythatpaysinterestatmaturity
74AMORDEGRCReturnsthedepreciationforeachaccountingperiodbyusingadepreciation
coefficient
75AMORLINCReturnsthedepreciationforeachaccountingperiod
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage10CopyrightMay2010
76COUPDAYBSReturnsthenumberofdaysfromthebeginningofthecouponperiodtothe
settlementdate
77COUPDAYSReturnsthenumberofdaysinthecouponperiodthatcontainsthe
settlementdate
78COUPDAYSNCReturnsthenumberofdaysfromthesettlementdatetothenextcoupon
date
79COUPNCDReturnsthenextcoupondateafterthesettlementdate
80COUPNUMReturnsthenumberofcouponspayablebetweenthesettlementdateand
maturitydate
81COUPPCDReturnsthepreviouscoupondatebeforethesettlementdate
82CUMIPMTReturnsthecumulativeinterestpaidbetweentwoperiods
83CUMPRINCReturnsthecumulativeprincipalpaidonaloanbetweentwoperiods
84DBReturnsthedepreciationofanassetforaspecifiedperiodbyusingthefixed‐
decliningbalancemethod
85DDBReturnsthedepreciationofanassetforaspecifiedperiodbyusingthe
double‐decliningbalancemethodorsomeothermethodthatyouspecify
86DISCReturnsthediscountrateforasecurity
87DOLLARDEConvertsadollarprice,expressedasafraction,intoadollarprice,expressed
asadecimalnumber
88DOLLARFRConvertsadollarprice,expressedasadecimalnumber,intoadollarprice,
expressedasafraction
89DURATIONReturnstheannualdurationofasecuritywithperiodicinterestpayments
90EFFECTReturnstheeffectiveannualinterestrate
91FVReturnsthefuturevalueofaninvestment
92FVSCHEDULEReturnsthefuturevalueofaninitialprincipalafterapplyingaseriesof
compoundinterestrates
93INTRATEReturnstheinterestrateforafullyinvestedsecurity
94IPMTReturnstheinterestpaymentforaninvestmentforagivenperiod
95IRRReturnstheinternalrateofreturnforaseriesofcashflows
96ISPMTCalculatestheinterestpaidduringaspecificperiodofaninvestment
97MDURATIONReturnstheMacauleymodifieddurationforasecuritywithanassumedpar
valueof$100
98MIRRReturnstheinternalrateofreturnwherepositiveandnegativecashflowsare
financedatdifferentrates
99NOMINALReturnstheannualnominalinterestrate
100NPERReturnsthenumberofperiodsforaninvestment
101NPVReturnsthenetpresentvalueofaninvestmentbasedonaseriesofperiodic
cashflowsandadiscountrate
102ODDFPRICEReturnsthepriceper$100facevalueofasecuritywithanoddfirstperiod
103ODDFYIELDReturnstheyieldofasecuritywithanoddfirstperiod
104ODDLPRICEReturnsthepriceper$100facevalueofasecuritywithanoddlastperiod
105ODDLYIELDReturnstheyieldofasecuritywithanoddlastperiod
106PMTReturnstheperiodicpaymentforanannuity
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage11CopyrightMay2010
107PPMTReturnsthepaymentontheprincipalforaninvestmentforagivenperiod
108PRICEReturnsthepriceper$100facevalueofasecuritythatpaysperiodicinterest
109PRICEDISCReturnsthepriceper$100facevalueofadiscountedsecurity
110PRICEMATReturnsthepriceper$100facevalueofasecuritythatpaysinterestat
maturity
111PVReturnsthepresentvalueofaninvestment
112RATEReturnstheinterestrateperperiodofanannuity
113RECEIVEDReturnstheamountreceivedatmaturityforafullyinvestedsecurity
114SLNReturnsthestraight‐linedepreciationofanassetforoneperiod
115SYDReturnsthesum‐of‐years'digitsdepreciationofanassetforaspecified
period
116TBILLEQReturnsthebond‐equivalentyieldforaTreasurybill
117TBILLPRICEReturnsthepriceper$100facevalueforaTreasurybill
118TBILLYIELDReturnstheyieldforaTreasurybill
119VDBReturnsthedepreciationofanassetforaspecifiedorpartialperiodbyusing
adecliningbalancemethod
120XIRRReturnstheinternalrateofreturnforascheduleofcashflowsthatisnot
necessarilyperiodic
121XNPVReturnsthenetpresentvalueforascheduleofcashflowsthatisnot
necessarilyperiodic
122YIELDReturnstheyieldonasecuritythatpaysperiodicinterest
123YIELDDISCReturnstheannualyieldforadiscountedsecurity;forexample,aTreasurybill
124YIELDMATReturnstheannualyieldofasecuritythatpaysinterestatmaturity
InformationFunctions
FunctionDescription
125CELLReturnsinformationabouttheformatting,location,orcontentsofacell
126ERROR.TYPEReturnsanumbercorrespondingtoanerrortype
127INFOReturnsinformationaboutthecurrentoperatingenvironment
128ISBLANKReturnsTRUEifthevalueisblank
129ISERRReturnsTRUEifthevalueisanyerrorvalueexcept#N/A
130ISERRORReturnsTRUEifthevalueisanyerrorvalue
131ISEVENReturnsTRUEifthenumberiseven
132ISLOGICALReturnsTRUEifthevalueisalogicalvalue
133ISNAReturnsTRUEifthevalueisthe#N/Aerrorvalue
134ISNONTEXTReturnsTRUEifthevalueisnottext
135ISNUMBERReturnsTRUEifthevalueisanumber
136ISODDReturnsTRUEifthenumberisodd
137ISREFReturnsTRUEifthevalueisareference
138ISTEXTReturnsTRUEifthevalueistext
139NReturnsavalueconvertedtoanumber
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage12CopyrightMay2010
140NAReturnstheerrorvalue#N/A
141TYPEReturnsanumberindicatingthedatatypeofavalue
17
LogicalFunctions
FunctionDescription
142ANDReturnsTRUEifallofitsargumentsareTRUE
143FALSEReturnsthelogicalvalueFALSE
144IFSpecifiesalogicaltesttoperform
145NOTReversesthelogicofitsargument
146ORReturnsTRUEifanyargumentisTRUE
147TRUEReturnsthelogicalvalueTRUE
LookupandReferenceFunctions
FunctionDescription
148ADDRESSReturnsareferenceastexttoasinglecellinaworksheet
149AREASReturnsthenumberofareasinareference
150CHOOSEChoosesavaluefromalistofvalues
151COLUMNReturnsthecolumnnumberofareference
152COLUMNSReturnsthenumberofcolumnsinareference
153GETPIVOTDATAReturnsdatastoredinaPivotTable
154HLOOKUPLooksinthetoprowofanarrayandreturnsthevalueoftheindicatedcell
155HYPERLINKCreatesashortcutorjumpthatopensadocumentstoredonanetwork
server,anintranet,ortheInternet
156INDEXUsesanindextochooseavaluefromareferenceorarray
157INDIRECTReturnsareferenceindicatedbyatextvalue
158LOOKUPLooksupvaluesinavectororarray
159MATCHLooksupvaluesinareferenceorarray
160OFFSETReturnsareferenceoffsetfromagivenreference
161ROWReturnstherownumberofareference
162ROWSReturnsthenumberofrowsinareference
163RTDRetrievesreal‐timedatafromaprogramthatsupportsCOM
automation(Automation:Awaytoworkwithanapplication'sobjectsfrom
anotherapplicationordevelopmenttool.FormerlycalledOLEAutomation,
AutomationisanindustrystandardandafeatureoftheComponentObject
Model(COM).)
164TRANSPOSEReturnsthetransposeofanarray
165VLOOKUPLooksinthefirstcolumnofanarrayandmovesacrosstherowtoreturnthe
valueofacell
MathandTrigonometryFunctions
FunctionDescription
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage13CopyrightMay2010
166ABSReturnstheabsolutevalueofanumber
167ACOSReturnsthearccosineofanumber
168ACOSHReturnstheinversehyperboliccosineofanumber
169ASINReturnsthearcsineofanumber
170ASINHReturnstheinversehyperbolicsineofanumber
171ATANReturnsthearctangentofanumber
172ATAN2Returnsthearctangentfromx‐andy‐coordinates
173ATANHReturnstheinversehyperbolictangentofanumber
174CEILINGRoundsanumbertothenearestintegerortothenearestmultipleof
significance
175COMBINReturnsthenumberofcombinationsforagivennumberofobjects
176COSReturnsthecosineofanumber
177COSHReturnsthehyperboliccosineofanumber
178DEGREESConvertsradianstodegrees
179EVENRoundsanumberuptothenearesteveninteger
180EXPReturnseraisedtothepowerofagivennumber
181FACTReturnsthefactorialofanumber
182FACTDOUBLEReturnsthedoublefactorialofanumber
183FLOORRoundsanumberdown,towardzero
184GCDReturnsthegreatestcommondivisor
185INTRoundsanumberdowntothenearestinteger
186LCMReturnstheleastcommonmultiple
187LNReturnsthenaturallogarithmofanumber
188LOGReturnsthelogarithmofanumbertoaspecifiedbase
189LOG10Returnsthebase‐10logarithmofanumber
190MDETERMReturnsthematrixdeterminantofanarray
191MINVERSEReturnsthematrixinverseofanarray
192MMULTReturnsthematrixproductoftwoarrays
193MODReturnstheremainderfromdivision
194MROUNDReturnsanumberroundedtothedesiredmultiple
195MULTINOMIALReturnsthemultinomialofasetofnumbers
196ODDRoundsanumberuptothenearestoddinteger
197PIReturnsthevalueofpi
198POWERReturnstheresultofanumberraisedtoapower
199PRODUCTMultipliesitsarguments
200QUOTIENTReturnstheintegerportionofadivision
201RADIANSConvertsdegreestoradians
202RANDReturnsarandomnumberbetween0and1
203RANDBETWEENReturnsarandomnumberbetweenthenumbersyouspecify
204ROMANConvertsanarabicnumeraltoroman,astext
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage14CopyrightMay2010
205ROUNDRoundsanumbertoaspecifiednumberofdigits
206ROUNDDOWNRoundsanumberdown,towardzero
207ROUNDUPRoundsanumberup,awayfromzero
208SERIESSUMReturnsthesumofapowerseriesbasedontheformula
209SIGNReturnsthesignofanumber
210SINReturnsthesineofthegivenangle
211SINHReturnsthehyperbolicsineofanumber
212SQRTReturnsapositivesquareroot
213SQRTPIReturnsthesquarerootof(number*pi)
214SUBTOTALReturnsasubtotalinalistordatabase
215SUMAddsitsarguments
216SUMIFAddsthecellsspecifiedbyagivencriteria
217SUMPRODUCTReturnsthesumoftheproductsofcorrespondingarraycomponents
218SUMSQReturnsthesumofthesquaresofthearguments
219SUMX2MY2Returnsthesumofthedifferenceofsquaresofcorrespondingvaluesintwo
arrays
220SUMX2PY2Returnsthesumofthesumofsquaresofcorrespondingvaluesintwoarrays
221SUMXMY2Returnsthesumofsquaresofdifferencesofcorrespondingvaluesintwo
arrays
222TANReturnsthetangentofanumber
223TANHReturnsthehyperbolictangentofanumber
224TRUNCTruncatesanumbertoaninteger
StatisticalFunctions
FunctionDescription
225AVEDEVReturnstheaverageoftheabsolutedeviationsofdatapointsfromtheir
mean
226AVERAGEReturnstheaverageofitsarguments
227AVERAGEAReturnstheaverageofitsarguments,includingnumbers,text,andlogical
values
228BETADISTReturnsthebetacumulativedistributionFunction
229BETAINVReturnstheinverseofthecumulativedistributionFunctionforaspecified
betadistribution
230BINOMDISTReturnstheindividualtermbinomialdistributionprobability
231CHIDISTReturnstheone‐tailedprobabilityofthechi‐squareddistribution
232CHIINVReturnstheinverseoftheone‐tailedprobabilityofthechi‐squared
distribution
233CHITESTReturnsthetestforindependence
234CONFIDENCEReturnstheconfidenceintervalforapopulationmean
235CORRELReturnsthecorrelationcoefficientbetweentwodatasets
236COUNTCountshowmanynumbersareinthelistofarguments
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage15CopyrightMay2010
237COUNTACountshowmanyvaluesareinthelistofarguments
238COUNTBLANKCountsthenumberofblankcellswithinarange
239COUNTIFCountsthenumberofnonblankcellswithinarangethatmeetthegiven
criteria
240COVARReturnscovariance,theaverageoftheproductsofpaireddeviations
241CRITBINOMReturnsthesmallestvalueforwhichthecumulativebinomialdistributionis
lessthanorequaltoacriterionvalue
242DEVSQReturnsthesumofsquaresofdeviations
243EXPONDISTReturnstheexponentialdistribution
244FDISTReturnstheFprobabilitydistribution
245FINVReturnstheinverseoftheFprobabilitydistribution
246FISHERReturnstheFishertransformation
247FISHERINVReturnstheinverseoftheFishertransformation
248FORECASTReturnsavaluealongalineartrend
249FREQUENCYReturnsafrequencydistributionasaverticalarray
250FTESTReturnstheresultofanF‐test
251GAMMADISTReturnsthegammadistribution
252GAMMAINVReturnstheinverseofthegammacumulativedistribution
253GAMMALNReturnsthenaturallogarithmofthegammaFunction,Γ(x)
254GEOMEANReturnsthegeometricmean
255GROWTHReturnsvaluesalonganexponentialtrend
256HARMEANReturnstheharmonicmean
257HYPGEOMDISTReturnsthehypergeometricdistribution
258INTERCEPTReturnstheinterceptofthelinearregressionline
259KURTReturnsthekurtosisofadataset
260LARGEReturnsthek‐thlargestvalueinadataset
261LINESTReturnstheparametersofalineartrend
262LOGESTReturnstheparametersofanexponentialtrend
263LOGINVReturnstheinverseofthelognormaldistribution
264LOGNORMDISTReturnsthecumulativelognormaldistribution
265MAXReturnsthemaximumvalueinalistofarguments
266MAXAReturnsthemaximumvalueinalistofarguments,includingnumbers,text,
andlogicalvalues
267MEDIANReturnsthemedianofthegivennumbers
268MINReturnstheminimumvalueinalistofarguments
269MINAReturnsthesmallestvalueinalistofarguments,includingnumbers,text,and
logicalvalues
270MODEReturnsthemostcommonvalueinadataset
271NEGBINOMDISTReturnsthenegativebinomialdistribution
272NORMDISTReturnsthenormalcumulativedistribution
273NORMINVReturnstheinverseofthenormalcumulativedistribution
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage16CopyrightMay2010
274NORMSDISTReturnsthestandardnormalcumulativedistribution
275NORMSINVReturnstheinverseofthestandardnormalcumulativedistribution
276PEARSONReturnsthePearsonproductmomentcorrelationcoefficient
277PERCENTILEReturnsthek‐thpercentileofvaluesinarange
278PERCENTRANKReturnsthepercentagerankofavalueinadataset
279PERMUTReturnsthenumberofpermutationsforagivennumberofobjects
280POISSONReturnsthePoissondistribution
281PROBReturnstheprobabilitythatvaluesinarangearebetweentwolimits
282QUARTILEReturnsthequartileofadataset
283RANKReturnstherankofanumberinalistofnumbers
284RSQReturnsthesquareofthePearsonproductmomentcorrelationcoefficient
285SKEWReturnstheskewnessofadistribution
286SLOPEReturnstheslopeofthelinearregressionline
287SMALLReturnsthek‐thsmallestvalueinadataset
288STANDARDIZEReturnsanormalizedvalue
289STDEVEstimatesstandarddeviationbasedonasample
290STDEVAEstimatesstandarddeviationbasedonasample,includingnumbers,text,and
logicalvalues
291STDEVPCalculatesstandarddeviationbasedontheentirepopulation
292STDEVPACalculatesstandarddeviationbasedontheentirepopulation,including
numbers,text,andlogicalvalues
293STEYXReturnsthestandarderrorofthepredictedy‐valueforeachxinthe
regression
294TDISTReturnstheStudent'st‐distribution
295TINVReturnstheinverseoftheStudent'st‐distribution
296TRENDReturnsvaluesalongalineartrend
297TRIMMEANReturnsthemeanoftheinteriorofadataset
298TTESTReturnstheprobabilityassociatedwithaStudent'st‐test
299VAREstimatesvariancebasedonasample
300VARAEstimatesvariancebasedonasample,includingnumbers,text,andlogical
values
301VARPCalculatesvariancebasedontheentirepopulation
302VARPACalculatesvariancebasedontheentirepopulation,includingnumbers,text,
andlogicalvalues
303WEIBULLReturnstheWeibulldistribution
304ZTESTReturnstheone‐tailedprobability‐valueofaz‐test
TextFunctions
FunctionDescription
305ASCChangesfull‐width(double‐byte)Englishlettersorkatakanawithina
characterstringtohalf‐width(single‐byte)characters
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage17CopyrightMay2010
306BAHTTEXTConvertsanumbertotext,usingtheß(baht)currencyformat
307CHARReturnsthecharacterspecifiedbythecodenumber
308CLEANRemovesallnonprintablecharactersfromtext
309CODEReturnsanumericcodeforthefirstcharacterinatextstring
310CONCATENATEJoinsseveraltextitemsintoonetextitem
311DOLLARConvertsanumbertotext,usingthe$(dollar)currencyformat
312EXACTCheckstoseeiftwotextvaluesareidentical
313FIND,FINDBFindsonetextvaluewithinanother(case‐sensitive)
314FIXEDFormatsanumberastextwithafixednumberofdecimals
315JISChangeshalf‐width(single‐byte)Englishlettersorkatakanawithinacharacter
stringtofull‐width(double‐byte)characters
316LEFT,LEFTBReturnstheleftmostcharactersfromatextvalue
317LEN,LENBReturnsthenumberofcharactersinatextstring
318LOWERConvertstexttolowercase
319MID,MIDBReturnsaspecificnumberofcharactersfromatextstringstartingatthe
positionyouspecify
320PHONETICExtractsthephonetic(furigana)charactersfromatextstring
321PROPERCapitalizesthefirstletterineachwordofatextvalue
322REPLACE,
REPLACEB
Replacescharacterswithintext
323REPTRepeatstextagivennumberoftimes
324RIGHT,RIGHTBReturnstherightmostcharactersfromatextvalue
325SEARCH,
SEARCHB
Findsonetextvaluewithinanother(notcase‐sensitive)
326SUBSTITUTESubstitutesnewtextforoldtextinatextstring
327TConvertsitsargumentstotext
328TEXTFormatsanumberandconvertsittotext
329TRIMRemovesspacesfromtext
330UPPERConvertstexttouppercase
331VALUEConvertsatextargumenttoanumber
ExternalFunctions
FunctionDescription
332EUROCONVERTConvertsanumbertoeuros,convertsanumberfromeurostoaeuro
membercurrency,orconvertsanumberfromoneeuromembercurrencyto
anotherbyusingtheeuroasanintermediary(triangulation)
333SQL.REQUESTConnectswithanexternaldatasourceandrunsaqueryfromaworksheet,
thenreturnstheresultasanarraywithouttheneedformacroprogramming
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage18CopyrightMay2010
Chapter2
The=IFFunction
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage19CopyrightMay2010
=IF
The“IF”functionisthemostpowerfulofallfunctions–notjustinExcel,butinany
programminglanguage.Commonlyreferredtoas“ConditionalProgramming”,itistheIF
functionthatenablesustointroducelogicalthinkingintoanyprogram.Thisfunctionisalso
referredtoasthe“If‐Then‐Else”command,“conditionalexpressions”,or“PropositionalLogic”.
ThefollowingWikisexplainsthisconceptinmoredetail:
http://en.wikipedia.org/wiki/Conditional_(programming).
http://en.wikipedia.org/wiki/Logical_conditional#Conditional_statements
ThecleverCPAcanusetheIFFunctiontobuildelaborateExceltemplatesandfinancialmodels
containinganalmostunlimitedamountofsophisticatedprogramming.Presentedbeloware
severalexamplestohelpyoubetterunderstandtheapplicationofthispowerfultool.
SimpleIF‐TheIFfunctionreturnsonevalueifaconditionyouspecifyevaluatestoTRUE,and
anothervalueifthatconditionevaluatestoFALSE.Presentedbelowisasimpleexample:
SimpleIFwithCalculation–Presentedbelowisanexamplethatisalittlemorecomplex:
SimpleIF–LargerExample‐PresentedbelowisyetanotherIFexampleonalittlelargerscale–
thisexampleshowshowonemightapplytheIFfunctiontoevaluatebudgetversusactual
comparisons.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage20CopyrightMay2010
SimpleIFwithDropDown‐Inthefollowingexample,theIFfunctionischeckingtoseeifthey
havesignedupforinsurance.Iftheyhave,thedeductionamountisentered.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage21CopyrightMay2010
SimpleIFwithCalculation‐ThenextIFfunctionexampleisdeterminingeachemployees
earnedvacationdays.Iftheyhaveworkedformorethanayear,theyhaveearned5vacation
daysplusonedayforeachadditionalfullyear.
NestedIFFunctions‐Inthissample,therearefourpossibilitiesforbonuses.
IFFunctionwithLogicalORArgument‐TeamsAandCmeetonTuesday,TeamsBandDmeet
onThursday.WewanttolistthemeetingdaysincolumnD.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage22CopyrightMay2010
MoreComplexIFFunctionExample‐ThefollowingIFexampleshowsamorecomplex
applicationinwhichtheuserselectsataxpayerstatusfromadropdownlist,whichthen
retrievesthecorrecttaxbase,threshold,andincrementaltaxratestobeusedincalculatingtax.
ThisexampleillustrateshowaCPAmightprepareanincomestatementtemplatethat
calculatestheappropriateamountoftaxesasnetincomeandthetaxpayerstatuschanges.
Essentiallythetemplatecalculatesthecorrecttaxgivenallfourpossibletaxpayerstatuses,and
theIFstatementsareusedtoselectthecorrectanswersbasedonthetaxpayerstatusselected.
Keepinmindthatdespitethemanyaccoladesmentionedabove,theIFFunctionisnotalways
thebestsolution.Forexample,theVLOOKUPwouldbeabetterandeasierfunctiontouseto
extractdatafromalistasshowninthenestedIFFunctionafewexamplesabove.ManyExcel
Functionsalsoprovidebuilt‐in“IF‐Then‐Else”functionality.
KeyPointersforUsingtheIFFunction:
1. Nesting–Youcanembedupto8nestedIFfunctionsinasingleformulainExcel2003,andupto
64IFnestedfunctionsinExcel2007.
2. AND,OR–YoucanusetheANDand/orORoperatortoaddmoreconditionstoanIFFunction.
3. VariationsofIF‐ExceloffersseveralvariationsoftheIFfunctionasfollows:COUNTIF,
COUNTIFS,SUMIF,SUMIFS.
4. EvaluatinganIFError–SincetheIFstatementprovidesonlyatrueorfalseresult,thereisno
waytoevaluateanIFFunctiontoERROR.Ifyoureceiveanerror,youwrotetheformulawrong.
5. TheNullSet‐TheDoubleQuotesistheNullSet,orabsenceofavalue.Forexample,when
testingforaZerobalanceortestingforablankcell,thefollowingIFfunctionswouldapply:
a. =IF(A1=0,”ZERO”,””)
b. =IF(A1=””,”Blank”,””)
(ExcelalsoprovidesanISBLANKFunctionthatwouldalsowork.)
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage23CopyrightMay2010
Chapter3
UsingFunctionsTo
Crunch&CleanData
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage24CopyrightMay2010
CleaningDataUsingFunctions
CPAsoftenreceiveorretrievedatafrommanysourcesinawidevarietyofformatssuchasText
orCSVformats.Youdon'talwayshavecontrolovertheformatandtypeofdatathatyouimport
fromanexternaldatasource,suchasadatabase,textfile,oraWebpage.Beforeyoucan
analyzethedata,youoftenneedtocleanitup.Fortunately,OfficeExcelhasmanyfeaturesto
helpyougetdatainthepreciseformatthatyouwant.Sometimes,thetaskisstraightforward
andthereisaspecificfeaturethatdoesthejobforyou.
Forexample,youcaneasilyuseSpellCheckertocleanupmisspelledwordsincolumnsthat
containcommentsordescriptions.Or,ifyouwanttoremoveduplicaterows,youcanquicklydo
thisbyusingtheRemoveDuplicatesdialogbox.Atothertimes,youmayneedtomanipulate
oneormorecolumnsbyusingaformulatoconverttheimportedvaluesintonewvalues.
Forexample,ifyouwanttoremovetrailingspaces,youcancreateanewcolumntocleanthe
databyusingaformula,fillingdownthenewcolumn,convertingthatnewcolumn'sformulas
tovalues,andthenremovingtheoriginalcolumn.Excelprovidesmanyfunctionstohelpyou
cleanyourdataasfollows:
1. Import
2. TexttoColumns
3. RemoveDuplicates
4. Find&Replace
5. SpellCheck
6. =UPPER
7. =LOWER
8. =PROPER
9. =FIND
10. =SEARCH
11. =LEN
12. =SUBSTITUTE
13. =REPLACE
14. =LEFT
15. =MID
16. =RIGHT
17. =VALUE
18. =CONCATENATE
19. =TEXT
20. =TRIM
21. =CLEAN
22. =FIXED
23. =DOLLAR
24. =CODE
25. Macros
1. ImportingDataintoExcel–Ofcourseexcelopensupexcelfiles,butwhathappenswhen
youattempttoopendatathatisnotcontainedinanExcelformat?TheansweristhatExcel
automaticallyimportsthatdataontheflyanddisplaysaImportWizardtohelpyou
completetheprocess.TheTextImportWizardexaminesthetextfilethatyouareimporting
andhelpsyouimportthedatathewaythatyouwant.TostarttheTextImportWizard,on
theDatatab,intheGetExternalDatagroup,clickFromText.Then,intheImportTextFile
dialogbox,double‐clickthetextfilethatyouwanttoimport.Thefollowingdialogboxwill
bedisplayed:
Ifitemsinthetextfileareseparatedbytabs,colons,semicolons,spaces,orother
characters,selectDelimited.Ifalloftheitemsineachcolumnarethesamelength,select
Fixedwidth.Instep3,clicktheAdvancedbuttontospecifythatoneormorenumericvalues
maycontainatrailingminussign.Alsoclickthedesireddataformatforeachcolumntobe
imported.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage26CopyrightMay2010
2. TexttoColumns–TheTexttoColumnscommandlocatedontheDataRibbonworksexactly
thesamewayasdescribedabove–theusersimplylaunchesittoconvertdatawithinan
existingworksheet.
3. RemovingDuplicateRows‐Duplicaterowsareacommonproblemwhenyouimportdata.
YoucanidentifyandremoveduplicaterowsbyusingtheData,AdvancedFilter,Unique
RecordsOnlytoolasshowinthescreenbelow.
4. FindandReplaceText–Thistoolcanbeusedtoidentifyandremoveleadingstring,suchas
alabelfollowedbyacolonandspace,orasuffix,suchasaparentheticphraseattheendof
thestringthatisobsoleteorunnecessary.Youcandothisbyfindinginstancesofthattext
andthenreplacingitwithnotextorothertext.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage27CopyrightMay2010
NoteworthyFindandReplacePoints:
1. Youcansearchandreplaceforanentireworksheet,ortheentireworkbook.
2. Youcanfindandreplaceformatswithnewformats.
3. Thereisacellchooseroptionthatmakesiteasiertofindandreplaceformats.
4. Ifyouhighlightarangeofcells,thensearchandreplaceonlysearchesandreplaces
withinthatrangeofcells.
5. Youcanreplaceallatonceoroneatatime.
6. Youcouldalsofindandreplacereferencesinaformula.
5. SpellCheck‐Youcanuseaspellcheckertonotonlyfindmisspelledwords,buttofindvaluesthat
arenotusedconsistently,suchasproductorcompanynames,byaddingthosevaluestoacustom
dictionary.Thespellcheckfunctionalsochecksyourgrammaraswell.
ChangingTheCaseOfText–YoucanuseoneormoreofthethreeCasefunctionsto
converttexttolowercaseletters,suchase‐mailaddresses,uppercaseletters,suchas
productcodes,orpropercase,suchasnamesorbooktitles.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage28CopyrightMay2010
6. =UPPER‐Convertstexttouppercaseletters.
7. =LOWER‐Convertsalluppercaselettersinatextstringtolowercaseletters.
8. =PROPER‐Capitalizesthefirstletterinatextstringandanyotherlettersintextthatfollowany
characterotherthanaletter.Convertsallotherletterstolowercaseletters.
MergingAndSplittingColumns‐Acommontaskafterimportingdatafromanexternaldata
sourceistoeithermergetwoormorecolumnsintoone,orsplitonecolumnintotwoor
morecolumns.Forexample,youmaywanttosplitacolumnthatcontainsafullnameintoa
firstandlastname.Or,youmaywanttosplitacolumnthatcontainsanaddressfieldinto
separatestreet,city,region,andpostalcodecolumns.Thereversemayalsobetrue.
Presentedbelowarefunctionsthattohelpyouaccomplishthesetasks:
9. =FIND–UseReturnsthestartingpositionofacharacter,stringofcharactersorwordwithacell.
Findiscasesensitive.
10. =SEARCH–Returnsthestartingpositionofacharacter,stringofcharactersorwordwithacell.
Searchisnotcasesensitive.
11. =LEN–Displaysthelengthornumberofcharactersinacell.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage29CopyrightMay2010
12. =SUBSTITUTE–Replacesacharacterorcharacterswithacharacterorcharactersthatyouspecify.
13. =REPLACE‐Replacesacharacterorcharacterswithacharacterorcharactersthatyouspecify.
14. =LEFT–Extractsthespecifiednumberofcharactersfromacell,startingfromtheleft.
15. =MID–Extractsthespecifiednumberofcharactersfromacell,startingfromsomewhereinthe
middleofthecell.
16. =RIGHT–Extractsthespecifiednumberofcharactersfromacell,startingfromtheright.
17. =Value–Convertstexttovaluessothedatacanbeadded,subtracted,multiplied,dividedor
referencedinafunction.
18. =CONCATENATE‐Joinstwoormoretextstringsintoonetextstring.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage30CopyrightMay2010
Variationsofthesefunctionsthatareusedwhenworkingwithforeignlanguages:
=FINDB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=SEARCHB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=REPLACEB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=LEFTB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=RIGHTB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=LENB–Usethiswhenworkingwithforeigncharacterslikethese("," )
=MIDB–Usethiswhenworkingwithforeigncharacterslikethese("," )
CleaningText–(RemovingSpacesAndNonprintingCharactersFromText)‐Sometimes
textvaluescontainleading,trailing,ormultipleembeddedspacecharacters(Unicode
charactersetvalues32and160),ornonprintingcharacters(Unicodecharactersetvalues0
to31,127,129,141,143,144,and157).Thesecharacterscansometimescauseunexpected
resultswhenyousort,filter,orsearch.Forexample,intheexternaldatasource,usersmay
maketypographicalerrorsbyinadvertentlyaddingextraspacecharacters,orimportedtext
datafromexternalsourcesmaycontainnonprintingcharactersthatareembeddedinthe
text.Becausethesecharactersarenoteasilynoticed,theunexpectedresultsmaybe
difficulttounderstand.Followingisalistoffunctionsyoucanusetoremovethese
unwantedcharacters:
19. =TEXT‐Convertsavaluetotextinaspecificnumberformat.
20. =TRIM‐Removesthe7‐bitASCIIspacecharacter(value32)fromtext.
21. =CLEAN‐Removesthefirst32nonprintingcharactersinthe7‐bitASCIIcode(values0
through31)fromtext.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage31CopyrightMay2010
22. =FIXED‐Roundsanumbertothespecifiednumberofdecimals,formatsthenumberin
decimalformatbyusingaperiodandcommas,andreturnstheresult.
23. =DOLLAR‐Convertsanumbertotextformatandappliesacurrencysymbol.
24. =CODE‐Returnsanumericcodeforthefirstcharacterinatextstring.
FixingDatesandTimes‐Therearemanydifferentdateformats,andthesevariedformats
maybeconfusedwithnumberedpartcodesorotherstringsthatcontainslashmarksor
hyphens,datesandtimesoftenneedtobeconvertedandreformatted.Presentedbelowis
alistoffunctionsthathelpyouaccomplishthistask.
25. =DATE‐Returnsthesequentialserialnumberthatrepresentsaparticulardate.Ifthecellformat
wasGeneralbeforethefunctionwasentered,theresultisformattedasadate.
26. =DATEVALUE‐Convertsadaterepresentedbytexttoaserialnumber.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage32CopyrightMay2010
27. =TIME‐ Returnsthedecimalnumberforaparticulartime.IfthecellformatwasGeneral
beforethefunctionwasentered,theresultisformattedasadate.
28. =TIMEVALUE‐ Returnsthedecimalnumberofthetimerepresentedbyatextstring.The
decimalnumberisavaluerangingfrom0(zero)to0.99999999,representingthetimes
from0:00:00(12:00:00AM)to23:59:59(11:59:59P.M.).
TransformingAndRearrangingColumnsAndRows‐Mostoftheanalysisandformatting
featuresinOfficeExcelassumethatthedataexistsinasingle,flattwo‐dimensionaltable.
Sometimesyoumaywanttomaketherowsbecomecolumns,andthecolumnsbecome
rows.Atothertimes,dataisnotevenstructuredinatabularformat,andyouneedawayto
transformthedatafromanontabulartoatabularformat.Thefollowingfunctioncanhelp
youachievethisgoal:
29. =TRANSPOSE‐Returnsaverticalrangeofcellsasahorizontalrange,orviceversa.
30. DataFillInTrick–AclevertrickforfillinginmissingdatacanbeaccomplishedusingtheGOTO,
Special,Blankscommand.Hereishowitworks.Thistrickworkswellwhenyouhavealargevolume
ofdatabutdescriptionsarenotprovidedforeveryrow,asshownintheexamplebelow:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage33CopyrightMay2010
Startbyenteringasimpleformulareferencingthedatalabelintheabovecell,justlikethis:
a. Nextcopythatformula...
b. HighlighttheentirerangecontainingdatalabelsincolumnsAandB.columns...
c. PresstheF5keytolaunchtheGoTodialogbox...
d. SelecttheOptionsBox...
e. Clickonthe“Blanks”radiobutton...
f. PressEnter...
g. Paste.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage34CopyrightMay2010
Thisactionwillcausealldatalabelstorepeatintheemptycellsbeneath.Next:
h. CopycolumnsA&B...
i. PasteSpecialasvaluestoconverttheformulastotextbaseddatalabels...
j. Youarenowreadytosort,filter,subtotalandpivotyourdata.
FetchingData‐Occasionally,databaseadministratorsuseOfficeExceltofindandcorrect
matchingerrorswhentwoormoretablesarejoined.Thismightinvolvereconcilingtwo
tablesfromdifferentworksheets,forexample,toseeallrecordsinbothtablesorto
comparetablesandfindrowsthatdon'tmatch.
31. =VLOOKUP‐Searchesforavalueinthefirstcolumnofatablearrayandreturnsavaluein
thesamerowfromanothercolumninthetablearray.Forexample,considertheexample
belowwhichusesa=VLOOKUPfunctiontocalculatetheappropriateamountoftaxdue
basedontheIRSrateschedule.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage35CopyrightMay2010
AstheIncomestatementshownintheshadedareaisupdated,theresultingtaxable
incomeamountisreferencedinCellF13.Next,3VLOOKUPfunctionspulltheappropriate
rate,baseandthresholdinformationfromtheratescheduletobeusedincalculating
incometax.Oncecalculated,theresultingtaxisreferencedbacktotheincomestatement
forthepurposesofcomputingNetincomeAftertaxes.
KeypointstoConsiderwhenUsingVLOOKUP:
a. Ifyouarelookingupbasedontext,thefirstcolumncontaininglookup
valuesmustbesortedalphabeticallyindescendingorder–elseitwillnot
workproperly.
b. Ifyouarelookingupbasedontext,youmusthaveanexactmatchbetween
thelookupvalueandthetablearrayvalue.
c. Ifyouarelookingupbasedonvalues,thefirstcolumncontaininglookup
valuesmustbesortednumericallyindescendingorder–elseitwillnotwork
properly.
d. Ifyouarelookingupbasedonvalues,thenExcelwillchoosetheclosest
valuewithoutgoingover.Forexample,ifthelookupvalueis198,000and
thetablearraycontainsvaluesof100,000and200,000,thenexcelwill
choose100,000because200,000goesoverorexceeds198,000.(Itmightbe
helpfultothinkbacktotheoldBobbarkergameshowthePriceisRight.)
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage36CopyrightMay2010
32. =HLOOKUP‐Searchesforavalueinthetoprowofatableoranarrayofvalues,andthen
returnsavalueinthesamecolumnfromarowyouspecifyinthetableorarray.
33. =INDEX‐Returnsavalueorthereferencetoavaluefromwithinatableorrange.Thereare
twoformsoftheINDEXfunction:thearrayformandthereferenceform.
34. =MATCH‐Returnstherelativepositionofaniteminanarraythatmatchesaspecified
valueinaspecifiedorder.UseMATCHinsteadofoneoftheLOOKUPfunctionswhenyou
needthepositionofaniteminarangeinsteadoftheitemitself.
35. =OFFSET‐Returnsareferencetoarangethatisaspecifiednumberofrowsandcolumns
fromacellorrangeofcells.Thereferencethatisreturnedcanbeasinglecellorarangeof
cells.Youcanspecifythenumberofrowsandthenumberofcolumnstobereturned.
36. DataCleaningwithMacros‐Toperiodicallycleanthesamedatasource,considerrecording
amacroorwritingcodetoautomatetheentireprocess.Therearealsoanumberof
externaladd‐inswrittenbythird‐partyvendors,listedintheThird‐partyproviderssection,
thatyoucanconsiderusingifyoudon'thavethetimeorresourcestoautomatetheprocess
onyourown.
37. RAND(),RANDBETWEEN(),ROUND()–InExcel2003,RANDBETWEENisnotinthe
standardEXCELinstallationbutiftheanalysistoolpackisinstalledandtheadd‐inactivated
itisanextremelyusefulfunction.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage37CopyrightMay2010
38. InformationalFunctions
CELL(info_type,reference)‐Info_type isatextvaluethatspecifieswhattypeofcell
informationyouwant.Thefollowinglistshowsthepossiblevaluesofinfo_typeandthe
correspondingresults.
Info_typeReturns
"address"Referenceofthefirstcellinreference,astext.
"col"Columnnumberofthecellinreference.
"color"1ifthecellisformattedincolorfornegativevalues;otherwisereturns0
(zero).
"contents"Valueoftheupper‐leftcellinreference;notaformula.
"filename"Filename(includingfullpath)ofthefilethatcontainsreference,astext.
Returnsemptytext("")iftheworksheetthatcontainsreferencehasnotyet
beensaved.
"format"Textvaluecorrespondingtothenumberformatofthecell.Thetextvalues
forthevariousformatsareshowninthefollowingtable.Returns"‐"atthe
endofthetextvalueifthecellisformattedincolorfornegativevalues.
Returns"()"attheendofthetextvalueifthecellisformattedwith
parenthesesforpositiveorallvalues.
"parentheses"1ifthecellisformattedwithparenthesesforpositiveorallvalues;
otherwisereturns0.
"prefix"Textvaluecorrespondingtothe"labelprefix"ofthecell.Returnssingle
quotationmark(')ifthecellcontainsleft‐alignedtext,doublequotation
mark(")ifthecellcontainsright‐alignedtext,caret(^)ifthecellcontains
centeredtext,backslash(\)ifthecellcontainsfill‐alignedtext,andempty
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage38CopyrightMay2010
text("")ifthecellcontainsanythingelse.
"protect"0ifthecellisnotlocked,and1ifthecellislocked.
"row"Rownumberofthecellinreference.
"type"Textvaluecorrespondingtothetypeofdatainthecell.Returns"b"for
blankifthecellisempty,"l"forlabelifthecellcontainsatextconstant,and
"v"forvalueifthecellcontainsanythingelse.
"width"Columnwidthofthecellroundedofftoaninteger.Eachunitofcolumn
widthisequaltothewidthofonecharacterinthedefaultfontsize.
Referencethecellthatyouwantinformationabout.Ifomitted,informationspecifiedin
info_typeisreturnedforthelastcellthatwaschanged.Thefollowinglistdescribesthetext
valuesCELLreturnswheninfo_typeis"format",andreferenceisacellformattedwitha
built‐innumberformat.
IftheMicrosoftExcelformatisCELLreturns
General "G"
0"F0"
#,##0 ",0"
0.00"F2"
#,##0.00 ",2"
$#,##0_);($#,##0) "C0"
$#,##0_);[Red]($#,##0) "C0‐"
$#,##0.00_);($#,##0.00)"C2"
$#,##0.00_);[Red]($#,##0.00) "C2‐"
0% "P0"
0.00% "P2"
0.00E+00 "S2"
#?/?or#??/??"G"
m/d/yyorm/d/yyh:mmormm/dd/yy"D4"
d‐mmm‐yyordd‐mmm‐yy"D1"
d‐mmmordd‐mmm"D2"
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage39CopyrightMay2010
mmm‐yy "D3"
mm/dd"D5"
h:mmAM/PM "D7"
h:mm:ssAM/PM "D6"
h:mm "D9"
h:mm:ss "D8"
Iftheinfo_typeargumentintheCELLformulais"format",andifthecellisformattedlater
withacustomformat,thenyoumustrecalculatetheworksheettoupdatetheCELLformula.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage40CopyrightMay2010
Third‐PartySolutions–IncaseExcelsbuiltinfunctionsarenotsufficienttomeetyour
needs,followingisapartiallistofthird‐partyprovidersthathaveproductsthatareusedto
cleandatainavarietyofways.
ProviderProduct
Add‐inExpressLtd.AdvancedFind&Replace,MergeCells
Wizard
Add‐Ins.comDuplicateFinder
AddinToolsAddinToolsAssist
CDXZipStream
Click2ConvertConvertsPDFtoExcelformats
DigDBAdd‐insforExcel®
JKPApplicationDevelopmentFlexfindforExcel
J‐Walk&Associates,Inc.PowerUtilityPakVersion7
OfficeAssistanceLLCSimilarDataFinderforExcel®
PAToolsPAToolsAdvancedFindReplace
PDF2XLConvertsPDFfilestoExcelFormats
SpinnakerSoftwareSolutionsSpinnakerDBtoolsforExcel
VonnixExcelPowerExpander4.6
WinPureListCleanerLite
ListCleanerPro
CleanandMatch2007
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage41CopyrightMay2010
Chapter4
DataCommands
TheHeart&SoulOfExcel
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage42CopyrightMay2010
TheDataMenu‐PerhapsthepartsofExcelthatareofmostvaluetoCPAs,butleastused
byCPAsaretheDatacommandsfoundundertheDatamenuinExcel2003andearlier,and
onthedataRibboninExcel2007.Thesecommandsareshownbelow,andwewill
concentratethenexthourtostudyingthesecommands.
DataSort‐TheSorttooldoesexactlywhatitimplies–itsortsanddata.Keysorting
pointsareasfollows:
1. ContiguousData‐The“AtoZ”sortingtoolcansortlargematrixofdata
automaticallyaslongasthedataiscontiguous.Inotherwords,yourdatashould
containnoblankcolumns,noblankrows,andthecolumnsmustallbelabeled.
OnlythenwillExcelalwayscorrectlyselecttheentirematrixforsorting.
2. AtoZButton‐Simplyplacethecursorinthedesiredcolumnforsorted,and
presstheAtoZorZtoAbuttonasthecasemaybe.Excelwillautomaticallysort
allcontinuouscolumnsthathaveheadingsandallcontiguousrowsfromthetop
rowundertheheadinglabelsdowntothelastrowintheselectedcolumnthat
containsdata.(Note‐Ifyouaccidentlyselect2cellsinsteadofjustone,your
resultswillnotbecorrect.)
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage43CopyrightMay2010
3. Sortby64Columns‐The“Sort”toolisdramaticallyenhancedinExcel2007asit
nowprovidestheabilitytosortbyupto64columns,insteadofjust3columns.
Presentedbelowisadialogboxwhichshowsthisexpandedfunctionality.
4. SortLefttoRight–Excelhasalwaysprovidedtheabilitytosortlefttoright.Todo
so,selecttheoptionsboxintheSortDialogboxandclickthecheckboxlabeled
“SortlefttoRight”asshownbelow.
5. SortbyColor–Excel2007nowprovidestheabilitytosortbyfontcolororbycell
color,orboth.Thisishandyinmanyways.SometimesCPAsusecolortotagor
markcertaincells‐andlaterfinditusefultobeabletosortbythosemarkings.In
othersituationsCPAsuseconditionalformattingtoapplycolortocellsusinga
widevarietyofrules.ThereafterExcelcansortthedatabasedontheresulting
colors.Thesort‐by‐coloroptionsareshownbelow.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage44CopyrightMay2010
Tobeaccurate,itwaspossibletosortbycolorinExcel2003.Toaccomplishthis
task,youneededtousethe=CELLfunctioninordertoidentifyinformationabout
agivencellsuchasthecellcolororfontcolor.Thereafter,theresultsofthat
functioncouldbeusedtosortrows–whicheffectivelymeansthatyoucansort
bycolorinExcel2003–butittakesabitmoreeffort.
6. SortByCustomList–AnothersortingcapabilityinExcelistheabilitytosortby
CustomList.Forexample,assumeaCPAfirmhastenpartners,andtheManaging
partnerpreferstobeshownatthetopofthelist,andtheremainingPartners
basedonseniority.Inthiscase,youcouldcreateaCustomListintheexcel
Optionsdialogboxlistingthepartnersinthedesiredorder,andthensortfuture
reportsbasedonthatorder.
Perhapsabetterexampleuseofthisfeaturewouldbetocreateanon‐alphabetic
customlistofyourchartofaccounts,andthensorttransactionstoproducea
generalledgerinchartofaccountorder–evenifyourpreferredchartofaccounts
isnotalphabetical.thepartnersenioritydoesnotmatchthealphabeticnames,
norany
FilteringData‐UsingAutoFiltertofilterdataallowsyoutoviewasubsetofyourdata
inarangeofcellsortable.Onceyouhavefilteredthedata,youcanapplyadditionalfilters
tofurtherrefineyourdataview.Whenyouaredone,youcanclearafiltertoonceagain
redisplayallofthedata.Tousethistool,startwithanylistofdataandturnonthe
AutoFiltertool.Thenpositionyourcursorinthecolumnyouwanttofilterandusethedrop
downarrowstoapplyyourfiltersasshowninthescreenbelow.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage45CopyrightMay2010
Oncethefiltersareapplied,youwillseeasubsetyourdata.Forexample,thescreen
presentedbelowshowsfiltereddataforonlyMaconandSavannahproperties.
Asfiltersareapplied,asmallfunnelappearsinthedropdownarrowbuttontoindicatethat
afilterhasbeenapplied.Youcanapplyfiltersformultiplecolumnssimultaneously.
KeyPointsConcerningTheAutoFilterCommand:
1. ContiguousData–TheAutoFiltertoolsworksbestwhenyouareworkingwithdata
thatiscontiguous.Inotherwords,yourdatashouldcontainnoblankcolumns,no
blankrows,andthecolumnsmustallbelabeled.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage46CopyrightMay2010
2. FilterbyMultipleColumns‐Youcanfilterbymorethanonecolumn.
3. RemovingFilters–InExcel2003andearlier,afasterwaytoremovemultiplefiltersis
toturnofffilteringandthenturnfilteringbackon.InExcel2007youcansimpleclick
theClearbuttonintheSortandFilterGroupasshownbelow.
4. FiltersareAdditive‐Eachadditionalfilterisbasedonthecurrentfilterandfurther
reducesthesubsetofdata.
5. ThreeTypesofFilters–Youcanfilterbasedonlistvalues,byformats,orbycriteria.
Eachofthesefiltertypesismutuallyexclusiveforeachrangeofcellsorcolumntable.
Forexample,youcanfilterbycellcolororbyalistofnumbers,butnotbyboth;you
canfilterbyiconorbyacustomfilter,butnotbyboth.
6. FiltersEnabled‐Adrop‐downarrowmeansthatfilteringisenabledbutnot
applied.
7. FilterApplied‐AFilterbuttonmeansthatafilterisapplied.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage47CopyrightMay2010
8. FilterSpanning‐Thecommandsunder
theAllDatesinthePeriodmenu,such
asJanuaryorQuarter2,filterbythe
periodnomatterwhattheyear.This
canbeuseful,forexample,tocompare
salesbyaperiodacrossseveralyears.
9. ThisYearvs.Year‐to‐DateFiltering‐
ThisYearandYear‐to‐Dateare
differentinthewaythatfuturedates
arehandled.ThisYearcanreturndates
inthefutureforthecurrentyear,
whereasYeartoDateonlyreturns
datesuptoandincludingthecurrent
date.
10. FilteringDates‐Alldatefiltersare
basedontheGregoriancalendaras
decreedbyPopeGregoryXIII,after
whomthecalendarwasnamed,on24
February1582.TheGregoriancalendarmodifiestheJuliancalendar'sregularfour‐
yearcycleofleapyearsasfollows:Everyyearthatisexactlydivisiblebyfourisaleap
year,exceptforyearsthatareexactlydivisibleby100;thecenturialyearsthatare
exactlydivisibleby400arestillleapyears.Forexample,theyear1900isnotaleap
year;theyear2000isaleapyear.
11. FilteringByDaysofWeek‐Ifyouwanttofilterbydaysoftheweek,simplyformat
thecellstoshowthedayoftheweek.
12. Top&BottomFiltering‐OntheDatatab,in
theSort&Filtergroup,clickFilter.Pointto
NumberFiltersandthenselectTop10.To
filterbynumber,clickItems.Tofilterby
percentage,clickPercent.Note‐Topand
bottomvaluesarebasedontheoriginal
rangeofcellsortablecolumnandnotthe
filteredsubsetofdata.
13. Above&BelowAverageFiltering‐Onthe
Datatab,intheSort&Filtergroup,click
Filter.PointtoFilterbyNumbersthatare
Above/BelowAverage.Note–Thesevalues
arebasedontheoriginalrangeofcellsor
tablecolumnandnotthefilteredsubsetofdata.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage48CopyrightMay2010
14. FilteringOutBlanks‐Tofilterforblanks,intheAutoFiltermenuatthetopofthelist
ofvalues,clear(SelectAll),andthenatthebottomofthelistofvalues,select
(Blanks).
15. FilteringByColor‐SelectFilterbyColor,andthendependingonthetypeofformat,
selectFilterbyCellColor,FilterbyFontColor,orFilterbyCellIcon.
16. FilterbySelection‐Tofilterbytext,number,ordateortime,clickFilterbySelected
Cell'sValueandthen:Tofilterbycellcolor,clickFilterbySelectedCell'sColor.To
filterbyfontcolor,clickFilterbySelectedCell'sFontColor.Tofilterbyicon,click
FilterbySelectedCell'sIcon.
17. RefreshingFilters‐Toreapplyafilterafterthedatachanges,clickacellintherange
ortable,andthenontheDatatab,intheSort&Filtergroup,clickReapply.
DataForm–Excel’s2003DataFormtoolmakesExcellookmoreandbehavemorelikea
database,suchasMicrosoftAccess.(TheFormbuttonhasnotbeenincludedontheOffice
FluentuserinterfaceRibbon,butyoucanstilluseitinOfficeExcel2007byaddingtheForm
buttontotheQuickAccessToolbar.)
Adataformprovidesaconvenientmeanstoenterordisplayonecompleterowof
informationinarangeortablewithoutscrollinghorizontally.Youmayfindthatusingadata
formcanmakedataentryeasierthanmovingfromcolumntocolumnwhenyouhavemore
columnsofdatathancanbeviewedonthescreen.Useadataformwhenasimpleformof
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage49CopyrightMay2010
textboxesthatlistthecolumnheadingsaslabelsissufficientandyoudon'tneed
sophisticatedorcustomformfeatures,suchasalistboxorspinbutton.
KeyPointsusingdataForm:
1. Youcannotprintadataform.
2. Becauseadataformisamodaldialogbox,youcannotuseeithertheExcelPrint
commandorPrintbuttonuntilyouclosethedataform.
3. YoumightconsiderusingtheWindowsPrintScreenkeytomakeanimageofthe
form,andthenpasteitintoMicrosoftWordforprinting.
DataSubtotals–Excelprovidesanautomaticsubtotalingwhichwillautomatically
calculateandinsertsubtotalsandgrandtotalsinyourlistortable.Onceinserted,Excel
recalculatessubtotalandgrandtotalvaluesautomaticallyasyouenterandeditthedetail
data.TheSubtotalcommandalsooutlinesthelistsothatyoucandisplayandhidethedetail
rowsforeachsubtotal.ExamplesofatheSubtotaldialogboxandaresultingsubtotaled
tableareshownbelow.
KeypointstoConsiderWhenUsingSubtotalingareasfollows:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage50CopyrightMay2010
1. ContiguousData–TheSubtotaltoolsworksbestwhenyouareworkingwithdata
thatiscontiguous.Inotherwords,yourdatashouldcontainnoblankcolumns,no
blankrows,andthecolumnsmustallbelabeled.
2. SortBeforeYourSubtotal‐Youmustsortthedatabythecolumnyouwishto
Subtotalby,elseyouwillreceiveerroneousresults.
3. OtherMathematicalApplications‐TheSubtotaltoolnotonlycalculatessubtotals,
butitcanalsocalculateminimums,maximums,averages,standarddeviations,and
otherfunctions.
4. Subtotalsin2007Tables–Excel2007deploysSubtotalingalittledifferentlyinthat
theSubtotaltoolappearsatthebottomofeachcolumnineachtable,asshownin
thescreenbelow.
5. AutomaticOutlining‐SubtotalingautomaticallyinsertsOutlines,whichisreally
cool.Youcanthencondenseandexpandthedataintotalandbysubtotal.Some
CPAsalsoliketocopyandpastethecondensedsubtotalinformationtoanother
locationbutfindthatthisprocesscopiesandpastesallofthedata.Therearetwo
waystoachieveacleancopyandpastewithoutgrabbingallthehiddendataas
follows:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage51CopyrightMay2010
a. CTRLkey–HoldtheControlKeydownwhileyouindividuallyclickoneachsubtotal
row.Thiswillenableyoutocopyandpastejustthesubtotaldata.Thisapproachcan
beproblematicbecauseifyoumis‐click,youhavetostartover.
b. SelectVisibleCells–AbetterapproachistousetheSelectVisibleCellstool.This
toolwillselectonthedatayoucansee,afterwhichthecopyandpasteroutinewill
yieldthedesiredresults.Thisoptionisbetterbecauseitisfasterandlesserror
prone.
DataValidation
DataValidationcanbeusedtolimitthedatathatcanbeenteredintoacell.Forexample,
youmightwanttheusertoenteronlyvaluesbetween1%and99%.Youmightalsousethis
tooltoenabledatainputtoadropdownlist.Thishastwoadvantagesinthatitcanbe
fasterandmoreaccurate.Startwiththedialogboxbelowtocreateyourdropdownlist
functionality.
Aftermakingallthenecessaryselectionsinthevalidationlistdialogbox,yourworksheet
willbehaveasshownbelow.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage52CopyrightMay2010
Youcanalsoprovidemessagestodefinewhatinputyouexpectforthecell,andinstructions
tohelpuserscorrectanyerrors.Forexample,inamarketingworkbook,youcansetupacell
toallowonlyaccountnumbersthatareexactlythreecharacterslong.Whenusersselectthe
cell,youcanshowthemamessagesuchasthisone:
Ifusersignorethismessageandtypeinvaliddatainthecell,suchasatwo‐digitorfive‐digit
number,youcanshowthemanactualerrormessage.Inamoreadvancedscenario,you
mightusedatavalidationtocalculatethemaximumallowedvalueinacellbasedonavalue
elsewhereintheworkbook.Inthefollowingexample,theuserhastyped$4,000incellE7,
whichexceedsthemaximumlimitspecifiedforcommissionsandbonuses.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage53CopyrightMay2010
Ifthepayrollbudgetweretoincreaseordecrease,theallowedmaximuminE7would
automaticallyincreaseordecreasewithit.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage54CopyrightMay2010
PivotTables
ThePivotTablereporttoolprovidesaninteractivewaytosummarizelargeamountsofdata.
UseshouldusethePivotTabletoolstocrunchandanalyzenumericaldataPivotTable
reportsareparticularlyusefulinthefollowingsituations:
a. Rearrangingrowstocolumnsorcolumnstorows(or"pivoting")toseedifferent
summariesofthesourcedata.
b. Filtering,sorting,grouping,andconditionallyformattingyourdata.
c. Preparingconcise,attractive,andannotatedonlineorprintedreports
d. Queryinglargeamountsofdata.
e. Subtotalingandaggregatingnumericdata.
f. Summarizingdatabycategoriesandsubcategories
g. Creatingcustomcalculationsandformulas.
h. Expandingandcollapsinglevelsofdata.
i. Drillingdowntodetailsfromthesummarydata
Inessence,PivotTablespresentmultidimensionaldataviewstotheuser–thisprocessis
oftenreferredtoas“modeling”,“data‐cubeanalysis”,or“OLAPdatacubes”.Tore‐arrange
thePivotTabledata,justdraganddropcolumnandrowheadingstomovedataaround.
PivotTablesareagreatdataanalysistoolformanagement.
IfyouhaveneverusedaPivotTablebefore,initiallytheconceptcanbedifficulttograsp.
ThebestwaytounderstandaPivotTableistocreateablankPivotTableandthendragand
dropfieldnamesontothatblanktable.Thiswayyouwillseetheresultingpivottable
magicallyappearanditwillhelpyoubetterunderstandtheimportantrelationshipbetween
thepivotpalletandthefieldnamelist.
Let’screateasimplePivotTable.StartwithanExcelworksheetdatathatcontainsseveral
columnsofdata–thedatamustincludecolumnandrowheadingsandithelpsifthedatais
contiguous.PlaceyourcursoranywhereinthedataandselectPivotTablefromtheData
menuinExcel2003andclickFinish;orfromtheinsertRibboninExcel2007.Thisprocessis
shownbelow:Let’sstartwithapageofdatasummarizingtheresultsoftaxseasonasallof
thetimesheetentrieshavebeenenteredontoasingleworksheetasshownbelow.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage55CopyrightMay2010
PlaceyourcursoranywhereinthedataandselectPivotTablefromtheInsertRibbonas
shownbelow:
Forlearningpurposeslet’srightmouseclickonthepivottableandselectPivotTableOptions,
Display,ClassicPivotTableLayout.Yourscreenwillnowappearasfollows:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage56CopyrightMay2010
IlikeforCPAstolearnhowtousePivotTablesinthisviewbecauseitvisuallyhelpsthem
understandtheallimportantrelationshipbettertheblankpivotpaletteandthePivotTable
fieldList,bothelementsofwhichareshowninthescreenabove.
Toproceed,simplydraganddropfieldnamesshownontherightontotheblankPivot
paletteshownontheleft.Witheachdrop,yourreportgrowslarger.Asanalternativeyou
couldusethecheckboxesnexttofieldnames–thisfunctionalityisnewinExcel2007.After
addedsomedatatoyourblankPivotPalette,yourdatawilllooksomethinglikethis:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage57CopyrightMay2010
NextformatandfilterthePivotReport.Veryquicklyyourreportcomestogetherasshown
below.NoticethefilterbuttonhasbeenappliedandaPivottablestylehasalsobeenapplied
forappearance.
Doubleclickingonanynumberinapivotreportwillautomaticallyproduceanewworksheet
completewithallsupportingdetailthatcomprisesthesummarynumber.
ThereareamultitudeofPivotTableoptionsthatcanbeappliedtoaltertheappearanceor
behaviorofyourPivottable.
KeyPointsConcerningPivotTablesareasFollows:
a. YoucancreateasmanyPivotReportsasyouwantfromyourinitialrawdatapage.Yourraw
dataremainsunchangedasnewPivottablesarecreated.
b. Asyourrawdatachanges,yourpivottablesareupdatedeachtimeyoupresstherefresh
button.OrifyoupreferyoucansetyourPivotTablestoupdatethemselvesatregularly
scheduledintervals–sayeverytenminutes.
c. AkeytounderstandingPivotTablesisunderstandingtherelationshipbetweentheBlank
PivotpaletteandthePivotTableFieldlist.Asdataisselectedinthelist,itappearsonthe
PivottableReport.
d. YoucanalterthePivotTablesimplebydragginganddroppingthefieldnamesindifferent
locationsonthePivotpalette,orindifferentlocationsinthePivotTableFieldlistBox.
e. PivotTablescanbepivoted.
f. PivotTablescanbesortedbyanyColumn.(Orbyanyrowwhensortinglefttoright)
g. PivotTablescanbeFiltered.
h. PivotTablescanbeDrilled.
i. PivotTablescanbecopiedandpasted.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage58CopyrightMay2010
j. PivotTablescanbeformattedusingPivotTableStyles,asshownbelow.
k. Subtotalsandgrandtotalscanbedisplayedorsuppressedattheusersdesire.
l. PivotTableDatacanbeshownasnumbersorpercentagesattheusersdesire.
m. PivotTablecannotonlybesummed,itcanbeaveraged,minimized,maximized,counted,etc.
n. Blankrowscanbedisplayedorsuppressedattheusersdesire.
o. Anewfeaturecalled“CompactForm”organizedmultiplecolumnlabelsintoaneatly
organizedoutlinewhichiseasiertoread.
p. PivotTablescanquerydatadirectlyfromanyODBCcompliantdatabase.ThePivotTabletool
foraccomplishingthistaskisnotincludedintheribbon–youwillfinditbyCustomizingthe
QuickAccessToolBarandsearchingthe“CommandsNotShownintheRibbon”tabtofind
thePivotTableandPivotChartWizardOption.
q. ManyaccountingsystemscanpushdataoutoftheaccountingsystemintoanExcel
PivotTableformat–thisiscommonlyreferredtoasanOLAPDataCube.OLAPdataCubeis
justafancywordforPivotTable–andthereisnodifference.
r. PivotTablescanautomaticallycombinedatafrommultipledatasources.ThePivotTabletool
foraccomplishingthistaskisnotincludedintheribbon–youwillfinditbyCustomizingthe
QuickAccessToolBarandsearchingthe“CommandsNotShownintheRibbon”tabtofind
thePivotTableandPivotChartWizardOption.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage59CopyrightMay2010
s. ExcelalsoprovidesaPivotChartfunctionwhichworkssimilarlytoPivotTables.Presented
belowisanexamplePivotChart.
Excel2003PivotTablesworkverysimilarlyasshownbelow.ExcelcreatesablankPivotTable,
andtheusermustdraganddropthevariousfieldsfromthePivotTableFieldListontothe
appropriatecolumn,row,ordatasection.Asyoudraganddroptheseitems,theresulting
reportisdisplayedonthefly.HereistheblankPivotPaletteview.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage60CopyrightMay2010
NowdraganddropfieldnamesfromthePivotTablefieldlistontothePivotpallet.This
actionwillautomaticallycreatePivotTablereports–andtheywillchangeeachtimeyou
dropadditionalfieldnames,ormovefieldnamesaround.Presentedbelowarebutafew
examplesofhundredsofpossiblereportsthatcouldbeviewedwiththisdatathroughthe
PivotTableformat.
Thisreportshownaboveshowsthetotalresultingsalesforeachmarketingcampaignfor
eachofthe4monthsmarketingcampaignswereconducted.
Inthisscreenweseethesameinformationisshownasapercentageofthetotal.Afew
observationsincludethefactthatoverallRadioSpotsarethemostprofitabletypeof
campaign,butonlyinAprilandJuly.InJanuaryandOctober,localadsanddirectmail,
respectively,producebetterresults.Further,Aprilcampaignshadthebestresponseoverall.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage61CopyrightMay2010
Furtheranalysisinthescreenabovetellsusthatourresultsvarywidelyfromonecitytothe
next.InNewYork,couponswereleasteffective,butcouponsweremosteffectivein
Columbus.PivotchartsbasedonPivotTabledatacanbemodifiedbypivotingand/or
narrowingthedata.TheycanalsobepublishedontheInternet(oronanIntranet)as
interactiveWebpages.Thisallowsusersto“play”withthedata.Thechartbelowprovidesa
visuallookatthedatashownabove.
FilteringPivotTables‐Ifyoutakeacloselookatyourresultingpivottables,youwillnotice
thatExcelautomaticallyinsertsafilterbuttononeachfieldlistasshownbythedropdown
arrowsinthescreenbelow:
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage62CopyrightMay2010
Thisdropdownfilterlistmakesiteasytorefineyourreporttoincludejustthedatayou
want.
DrillingPivotTables‐Anothernicefeatureinpivottablesisthattheyareautomatically
drillable.SimplydoubleclickonanynumberinapivotreporttophaveExcelautomatically
insertanewsheetandproducethedetailedreportunderlyingthenumberyouclickedon.
Anexampleofthisisshownbelow:
PivotTableOptions‐Byrightmouseclickingonyourpivottableyouwillrevealseveral
optionsettingsboxesasshownbelow.Forexample,theseoptionsboxescontrolthetypesof
subtotalsproducedinyourpivotreports.Excelalsooffersapivottableoptionsboxaswellas
alayoutwizardthatmakesproducingpivottablesalittleeasier.
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage63CopyrightMay2010
ExcelFunctions,Macros&DataCommands
www.CarltonCollins.comPage64CopyrightMay2010
DataTable(“What‐ifAnalysis”)
Datatablesarepartofasuiteofcommandsthatarecalledwhat‐ifanalysistools.Whenyou
usedatatables,youaredoing“what‐ifanalysis”.What‐ifanalysisistheprocessofchanging
thevaluesincellstoseehowthosechangeswillaffecttheoutcomeofformulasonthe
worksheet.Forexample,youcanuseadatatabletovarytheinterestrateandtermlength
thatareusedinaloantodeterminepossiblemonthlypaymentamounts.
ThreecategoriesofWhat‐ifAnalysisTools‐Therearethreekindsofwhat‐ifanalysistoolsin
Excel:
1. DataTables
2. GoalSeek
3. Scenarios
Adatatablecannotaccommodatemorethantwovariables.Ifyouwanttoanalyzemore
thantwovariables,youshouldinsteadusescenarios.Althoughitislimitedtoonlyoneor
twovariables(onefortherowinputcellandoneforthecolumninputcell),adatatablecan
includeasmanydifferentvariablevaluesasyouwant.Ascenariocanhaveamaximumof32
differentvalues,butyoucancreateasmanyscenariosasyouwant.
LoanAnalysis‐Inthisexercise,westartbycreatingasimplePaymentfunctiontocalculate
thepaymentamountofaloangivena