handouts excel
TRANSCRIPT
-
8/12/2019 Handouts Excel
1/27
CentreforDevelopmentofTeachingandLearning(CDTL)
NationalUniversityofSingapore
email: [email protected]
FormulasandFunctionswithExcel
KiruthikaRagupathiPrincipalEducationalTechnologist
-
8/12/2019 Handouts Excel
2/27
TABLE OF CONTENTS
Introduction................................................................................................................4
ExploringtheExcelWorkspace....................................................................................4
NavigatingtheWorkbook............................................................................................4
SettingupData............................................................................................................6
Insertinganewcolumnorrow..................................................................................................6
Formattingtheworksheet.........................................................................................................6
VerifyingData..............................................................................................................7
Formulas
and
Functions
...............................................................................................
8
Constructingaformula..............................................................................................................8
Insertingafunction..................................................................................................................10
BuiltinFunctions.....................................................................................................................11
MathematicalCalculations........................................................................................13
ConditionalCalculations............................................................................................16
Cuttingup&PiecingtogetherTextStringsusingTextfunctions................................17
UsingLookuptables/References.............................................................................18
PivotTables...............................................................................................................20
CreateaPivotTablefromworksheetdata...............................................................................20
Statisticalfunctions...................................................................................................21
BasicStatisticalbuiltinfunctions............................................................................................21
Linearregressionfunctions......................................................................................................23
StatisticalAnalysis.....................................................................................................24
UsingtheAnalysisToolPak......................................................................................................24
DescriptiveStatistics................................................................................................................25
MoreInformation......................................................................................................27
-
8/12/2019 Handouts Excel
3/27
3 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Synopsis
Needtoperformcomplexcalculationsanddataanalysis?Theusageofformulasandfunctionsiswhat
givesanExcelspreadsheetmuchofitspower.Thisworkshopexplorestheformulaandfunctionsthat
are useful for computing andmanaging data. This course beginswithmathematical principles and
moveson
to
basic
formula
construction.
Participants
will
learn
about
mathematical
functions,
statistical
functions,conditionalcalculations,and lookuptables. Inaddition,theuseofAnalysisToolPakwillbe
discussedaidinginthegenerationofdescriptivestatisticsandregression.
Objectives
Bytheendofthisworkshop,participantsshouldbeableto:
Setupandverifydata Understandthemathematical orderofoperationsusedbyExcel Usetheappropriatetypeofcellreference Constructbasicformulas Usestatisticalfunctions Performconditionalcalculations UseAnalysisToolpak
-
8/12/2019 Handouts Excel
4/27
4 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Introduction
Microsoft Excel hasmany capabilities thatmake it suitable for use as a datamanagement tool. It
providesmultiple features fororganisingandmanagingdata,soyoucanensurethatdata isentered
correctlyand
calculations
and
formulas
are
valid.
Dataorganisationfeaturesenableyouto:
sortandfilterdata, summariseandgroupdata,and outlinedatasothatyoucanfocusonthekeypartsofyourdata.
Validationfeaturesareveryimportantformaintainingaccuraterecordsandtoensurethat
thedataiscorrect, itisenteredintheproperformat,and formulasareworkingcorrectly,
Excelmakes
use
of
formulas
(mathematical
expressions
that
you
create)
and
functions
(mathematical
expressionsthatarealreadyavailableinExcel)todynamicallycalculateresultsfromthedataavailable
inyourworksheets.
ExploringtheExcelWorkspace
Letusstartwithanoverviewofthemostimportantelementsofthecommandarea.
1. Use theOfficeButton toopennewor savedworkbooks, save,printor closeworkbooksormanageExceloptions.
2. YoucansetupacustomQuickAccesstoolbarontheupperleftcornerofthescreen.Youcanplacethemostcommonlyusedcommandshere.
3. TheRibbon issplit intotabswherethecommandsareorganised into logicalgroups.EachtabcorrespondstothevarioustoolbarsusedinthepreviousversionsofExcel.
4. AnExcelhelpfunctionasaquestionmarkiconontheouterrightoftheRibbon.NavigatingtheWorkbook
Thissectionexplainshowtonavigateaspreadsheettoeditandformatcells.Theconceptscaneasilybe
applied toearlyversionsofExcel;menu locationsmaydifferbutcommandsare thesame.Thecore
document
of
Excel
is
a
workbook.
An
Excel
workbook
can
hold
any
number
of
sheets.
Several
worksheetscanbesavedtogethertoformaworkbook.Themaintypesofsheetsare:
Worksheets Chartsheets
Atanyonetime,onlyonesheetisactiveinaworkbook.Eachspreadsheetisgriddedintocolumnsand
rows.Columnsaredenotedusing letters,androwsaredenotedbynumbers.Cellsarereferencedby
theircolumnandrow.Forexample,thecellintheupper lefthandcornerofthespreadsheetiscalled
A1,foritisincolumnAandrow1.
-
8/12/2019 Handouts Excel
5/27
5 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Belowisapictureofablankworkbookanddescriptionsofthemorefrequentlyuseditems.
Creatinganewworkbook
StartanewworkbookbyclickingtheOfficeButtonandselectingNew.IntheNewWorkbookwindow,
clickBlankworkbook.WhenyoustartExcel,ablankworksheetopens.
Selectingcells
Editindividual
cells
by
clicking
on
them.
Click
acell
and
drag
the
mouse
pointer
to
select
arange
of
cells.
You can also select entire rows and columns by clicking on the number or letter heading of that
alignment.Toselectnonadjacentcells,holddowntheCTRLkey,andthenclickthecellsthatyouwant.
Addingdatamanually
To enter data manually into the spreadsheet, double click on the cell you want to edit. Notice that
whateveryoutypeappearsinboththecellandthecelleditoratthetop.Whenyouarefinishedtyping,
pressEnter.
Addinganewworksheet
ClicktheInsertWorksheettabatthebottomofthescreen.
Toinsert
anew
worksheet
in
front
of
an
existing
worksheet,
select
that
worksheet
and
then,
on
the
Hometab,intheCellsgroup,clickInsert,andthenclickInsertSheet.Youcanalsorightclickthetabof
anexistingworksheet,andthenclickInsert.OntheGeneraltab,clickWorksheet,andthenclickOK.
Renamingtheworksheet
DoubleclicktheNametab;whenthedefaultnameisselected,typethenewname.Youcanalsoright
clickontheNameTabandchooseRenametotype inthenewname.Eachworksheetcanbecolour
coded,assettingdifferentcolorsishelpfulwhenyouhavealargenumberofworksheetsinaworkbook.
TosetthecoloroftheWorksheettabs,rightclickonthetabandselectanewcolor.
InsertWorksheet
-
8/12/2019 Handouts Excel
6/27
6 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Navigating
Tochangetheactivecell,usethearrowkeys,PageUporPageDownkeys,orusethemousetoclicka
newcellordragthescrollbars.
Embeddingchartsandpictures
TocreateanewchartinExcel,ontheInsertmenu,fromtheChartsgroup,choosethecharttypeyou
prefer.Toinsertanotherfile,suchasaclipart,pictureorascannedimage,fromtheInserttab,under
theIllustrations
group,
choose
Picture
or
Clipart.
SettingupData
Touseaspreadsheetefficiently,ithelpstoorganisethedatasothatitiseasytoread.Whengrading,
columnsaretypicallyused foreachassessment item,whereasrowsareused forthe individuals.The
firstrowwillbeusedforthecolumntitlesandthefirstcolumnwillbeusedfortheserialnumber.You
canusethesecondrowtoindicatethemaximumpossiblescoreforeachoftheassessmentitem.
Insertinganewcolumnorrow
Theprocessforinsertingrowsandcolumns issimilar.To insertacolumn,clicktheheaderwhereyou
wantto
add
anew
column
or
row.
On
the
header,
right
click
and
in
the
drop
down
context
menu,
selectInsert.
YoumayalsousetheInsertbuttontoaddnewcolumnsfound intheHometab,
Cellsgroup.Whenyou insertacolumnorrow,contentfound incolumnswillbe
movedtotheright,andcontentinrowswillbemoveddown.
Formattingtheworksheet
Theformattingofacellreferstoboththewayitisstyled(stylisticformatting)andthewayitfunctions
(numeric formatting). Formatting includes display characteristics such as font, size, alignment, style,
color,aswellasthetypeofdatathatthecellcontains.For instance,acellcanbeformattedtotreat
anydata
entered
as
amonetary
amount
and
display
only
whole
dollar
amounts.
Stylistic
formatting
optionsmakeyourworksheetmoreattractiveandeasiertoread.
Appearance
Formatting the appearance
of cells, rows, and columns
can be done with buttons in
theHomeribbonorbyright
clickingandchoosingoptions
from Format menu. To
formatcells,selecttheHome
ribbon then select the
column,
row,
group
or
thecellsthatyouwanttoformat.
Then, select the formatting
optionsyoudesire.
AnewformattingconceptcalledthedocumentthemeshasbeenintroducedinExcel2007andcanbefoundinthePageLayoutTab.Theseallowyoutosetmanyformattingoptionsatonce.
DataTypes
-
8/12/2019 Handouts Excel
7/27
-
8/12/2019 Handouts Excel
8/27
8 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
UsingtheExcelOptions,andintheCustomizesection,chooseAllCommands. ThenscrolldowntoselecttheSpeakCellscommand ClickAddandclickOK.AndthisoptionisnowavailableforuseintheQuickAccesstoolbar. Each time, you want to use a texttospeech command, choose the icon , from the Quick
AccessToolbar.
FormulasandFunctions
FormulasaretherealpowerofanExcelspreadsheet.Aformulausesstandardmathematicalsymbols
tooperateoncelladdressesand/ornumbers.Aformulacanbeacombinationofvalues(numbersor
cell references) and mathematical operators into an algebraic expression. Mathematical operators
includethefollowingsymbols:
+ foraddition
forsubtraction
* formultiplication
/ fordivision
%
forpercentage
^ forexponentiation(power)
Inadditionyoucanuseparenthesesanddecimalpoints,whereneeded.
Constructingaformula
ExcelrequiresthatEVERYformulabeginwithanequalsign(=).Ifyoujusttypewithoutthissymbol,Exceltreatstheentryastext.
Tostartenteringaformulainacell,clickinthatcellandthentypetheformula.TypeEnterorTabtomovetothenextcellwhenyouhavefinishedenteringtheformula.
Formulascontainingnumberswillproduceresultsthatwillnotchange.e.g.,theformula=200*7always
produces
the
result
1400.
However,aformulathatcontainscellreferencesproducesaresultthatmaychangedependingon
thedatainthecell.e.g.,theformula= C2+D2willproducearesultbasedonthedataincellsC2andD2.
Toviewtheformulasthatarecontainedinyourworksheet,pressCTRLand`(theapostrophekey)together. Repeattohidetheformulasandshowthevalues.
All formulas follow the standardmathematicalorderof operations whencalculating the results.e.g.,theformula= A2 + B2 * C2willadddataincellA2withthemultipliedproductofB2andC2.
Ifapartoftheformulaisinparenthesis,thenthatpartwillbecalculatedfirst. Afterexpressionsintheparentheses,ExcelwillcalculateyourformulausingtheMathoperatorsin
thefollowingorder:Multiplication,Division,AdditionandSubtraction.
-
8/12/2019 Handouts Excel
9/27
-
8/12/2019 Handouts Excel
10/27
10 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
6. Forexample,tofindtheaverageofthevaluesinthecellsA2toA10youcoulddothisseveralways:
= ( A2 + A3 + A4 + A5) / 4
= SUM ( A2, A3, A4, A5) / 4
= SUM ( A2: A5) / 4
= AVERAGE ( A2, A3, A4, A5)
= AVERAGE ( A2: A5)
These formulaswouldallgivethesameresult ifallthecellscontainedvaluesbuttheeasiest
onetotype isprobablythebottomone. It isalsosafertousetheAVERAGE functionasthat
calculateshowmanyvaluesthereareintherangeyouselect,using=SUM(A2:A5)/4wouldlead
toanerror ifoneofthosecellswas intentionallyablankrowasyoumayonlyhave3actual
valuesinthatrange.
Insertingafunction
Afunctionisapredefined/prewrittenformulathattakesavalueorvalues,performsanoperationona
range of cells you select, and returns a value or values. Functions are used to simplify and shorten
formulason
aworksheet,
especially
those
that
perform
lengthy
or
complex
calculations.
Excel
refers
to
eachrangeofcellsinthefunctionasanargument.Forcomplexcalculations, itmightbenecessaryto
useasmanyas3to4arguments.
1. Selectthecellwhereyouwouldliketheaveragescoretoappear.2. FromtheFormulastab,chooseInsertFunction.
3. Or,youcouldalsoclickontheFunctionbutton, found just before the
formulabartouseanyofExcelspreset
functions.
4. TheInsertFunctiondialogboxappears.5. Under Select a function, choose from
therangeoffunctionsavailable.
6. For example, choose theSUM functionandclickOK.
-
8/12/2019 Handouts Excel
11/27
11 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
7. TheFunctionArgumentsdialogboxasshownbelowappears.8. ForexampleletusconsidertheSUMfunctionthataddsallthenumbersinarangeofcells.
9.
Under
the
Number1
type
the
range
of
cells
that
you
want
to
use
or
you
can
also
drag
the
mousetoselecttherangeofcellstobeincludedasthefunctionsargumentsandclickOk.
10.Theformularesultisdisplayedonthewindowforyouasapreview.
BuiltinFunctions
Excelhasavarietyofbuiltinfunctionsthatcanbeaccessedusing
theFormulaWizard.
1. Clickinthecellwhereyouwanttheresultoftheformulatobeplaced. Nowclickonthe=signintheformulabar.
2.
Click
on
the
drop
down
arrow
to
the
left
of
the
formula
bartoselectthefunctionyouwishtouse.
3. ClickontheMoreFunctions...optionatthebottomofthelisttodisplayawindowshowingallthe
availablefunctions.
4. Whenyouhaveselectedthefunction,theInsertFunctiondialogboxopenstohelp
youcompletetheargumentsafterthe
functionsothatExcelcalculatestheright
result.
5. Wheneachfunctionisselectedashortdescription
of
the
function
and
the
type
of
argumentstobeusedisdisplayedinthe
dialogbox.
6. ForafunctionliketheSUMSQfunctionyouneedtoselectarangeofcells(C2:F2inthis
case)toaddtogetherthesumsofthe
squaresoftheargumentschosen.
-
8/12/2019 Handouts Excel
12/27
-
8/12/2019 Handouts Excel
13/27
-
8/12/2019 Handouts Excel
14/27
14 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
SUM=SUM(A1,B6,G6) willreturnthesumofthevaluesincellsA1,B6andG6
=SUM(A1:A23) willreturnthesumofthevaluesincellsA1toA23
=SUM(A1:A23,F3:F34) willreturnthesumofthevaluesincellsA1toA23plusthesumof
thevaluesincellsF3 toF34
Forexample,
if
you
would
require
ayearly
summary
report,
you
want
to
sum
the
values
in
cells
B2
of
eachofthemonthlysheets.Youhavenamedyoursheets"Jan","Feb",etc.Thentocalculate,key in
thefollowingformula:=Jan!B2+Feb!B2+Mar!B2...+Dec!B2
Youcanalsowritethisasfollows:=SUM(Jan:Dec!B2)
SUMIF
ThegeneralformatfortheSUMIFformulaisasfollows:
=SUMIF(rangewherethecriteriaistobeapplied,criteria,sumwhat).
A B C D
1
Date
Country
Name
Amount
2 05/01/2011 IN Lim 2
3 06/01/2011 SG Peter 6
4 07/01/2011 US Lim 8
5 05/01/2011 AU Peter 3
6 06/01/2011 DE Lim 4
7 07/01/2011 CN Peter 6
Example1: SumthevaluesofthecellsD2toD7,onlyiftheyaregreaterthan5
=SUMIF(D2:D7,">5",D2:D7);Resultshouldbe20.
Example2:
Sum
the
values
of
the
cells
D2
to
D7
ifthe
value
in
cells
C2
to
C7
is
Lim
or
equivalent
to
thevalueincellC2.
=SUMIF(C2:C7,"Lim" ,D2:D7);Resultshouldbe14.
or=SUMIF(C2:C7,C2 ,D2:D7)
SUMPRODUCT
Let'ssaythatyouhaveaseriesofquantities incellsA1toA5andaseriesofunitprices inB1toB5.
WithSUMPRODUCTyoucancalculatetotalsaleswiththisformula:=SUMPRODUCT(A1:A5,B1:B5)
BasicallySUMPRODUCTsumsA1multipliedbyB1plusA2multipliedbyB2andsoon.Butyoucould
alsoapplyspecificconditionstoit.
=SUMPRODUCT(A1:A5,B1:B5, (C1:C5="Lim")*1)
SUBTOTAL
WhentheFilterDataisused,thentheSUBTOTALfunctionisaveryusefulandinterestingfunction.The
function SUBTOTAL allows to count, to sum or to calculate the average of filtered elements of a
database.
-
8/12/2019 Handouts Excel
15/27
15 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Thefunctionrequirestwoarguments:
the first is a number between 1 and 11 that specifies the operation to be executed: 1(forAVERAGE); 2(for COUNT); 3(for COUNTA); 4(for MAX); 5(for MIN); 6(for PRODUCT); 7(for
STDEV);8(forSTDEVP);9(forSUM);10(forVAR);11(forVARP).
thesecondistherangecoveredbythefunctionandHence,ifyouwantthesumofB2:45,thenusethefollowing:
=SUBTOTAL(9,B2:B45)
Roundingupthedecimals
Whenyouspecify inthe formatofacell thatyouwantonly2decimalsExcelshowsonly2decimals
(roundingup)BUTyoushouldnotethatstillusesallthedecimals.Forexample,ifincellA1youentered
2.1456andusea2decimalformat,youwillsee2.15.NowifincellB1youwritetheformula=A1and
make the format "General"youwill see still see2.1456.Hence, functions like INT,TRUNC,ROUND,
ROUNDUPandROUNDDOWNwillenableyoutouseaspecificnumberofdecimalsinyourcalculations.
TRUNC
The TRUNC function does the same as the INT or ROUNDDOWN functions. The TRUNC function
removesdecimalswithoutrounding.Ifyouhave2.2or2.7incellA1=TRUNC (A1,0)willreturn2.
Interestinglyenough if youhave12345 inB1usingaminus sign in the second argumentofTRUNC
=TRUNC(B1,-3)will
return
(12,000).
This
is
very
useful
when
you
don't
want
to
show
the
hundreds,
thetensandunitsinareport.
ROUND
Thisfunctionremovesdecimalsroundingupthelastdecimalifthenextoneis5orover.Soifyouhave
4.126incellA1andusetheformula=ROUND(A1,2) theresultwillbe4.13ifthevalueinA1is4.123
theresultwillbe4.12.
ABS
=ABS(A1)willreturn5ifincellA1youhave5or5.Thisfunctionremovesthesign.
MOD
Themodulo
is
the
remainder
left
after
adivision.
=MOD(32,6)
is2becauseyouhave5times6in30andtheremainderis2.
SQRTandPOWER
Toextractthesquarerootofanumberyouwilluseaformulalike:
=SQRT(16)thatwillresultin4because4multipliedby4is16or
=SQRT(A1) thatwillalsoresultin4 ifthevalueincellA1is16.
There isnospecificExcelfunctiontoextractthecubicrootoranyotherroot,butcanbeachievedby
usingPOWERfunction.Youcanraiseanumbertoapower(multiplyingitbyitselfacertainnumberof
timeswiththisfunction.Hence:
=POWER(4,2)will
result
in
16
(4
times
4)
or
=POWER(A1,2)willalsoresultin16 ifthevalueincellA1is4.
=POWER(A1,1/2)willgivethesquarerootofthevalueincellA1
=POWER(A1,1/3)willgivethecubicrootofthevalueincellA1
-
8/12/2019 Handouts Excel
16/27
16 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
ConditionalCalculations
Excel has several logical functions that allow you to test cells and perform different operations
dependingontheircontents.
IF()function
TheIF()functionenablesyoutospecifytwodifferentcalculationsbasedonacertaincondition:
=IF(condition,calculationifconditionistrue,calculationifconditionisfalse)
Iftheconditionspecified inthefirstargument istrue,Excelperformsthecalculationspecified inthe
secondargument,otherwiseExcelcalculatesthethirdargument.
Inthefigurebelow,supposeyouhaveanexperimentaltestresultsthatallowsyoutotakeaadditional
value4.Specifically,iftheexperimentalvalue3ishighertheadditionalvaluetaken,thentheadjusted
valuewillbetheaverageofvalue3andtheadditionalvalue3.Iftheadditionalvalueisnothigherthan
the value 3, then their adjusted value score is their actual Test value 3. The IF( ) function below
performsthiscalculationtoadjustthescoreforthecellsincolumnF.
= IF(E2>D2, (D2+E2)/2, D2)or= IF(D2>E2, D2, (D2+E2)/2)
A B C D E F G
1 Value1 Value2 Value3Additional
Value 3
Adjusted
Value
Final
Value
2 Iteration1 88 73 82 80 82 81
3 Iteration2 52 70 64 70 67 63
4 Iteration3 87 73 82 80 82 81
5 Iteration4 76 74 78 80 79 76
Thefirst
argument,
E2>D2,
tests
whether
the
value
3is
better
than
the
additional
value
3.
If
the
conditionistrue,thesecondcalculationisperformed(theaverageofthetwovalues,(E2+D2)/2).Ifthe
conditionisfalse,theadjustedvalueissimplytheactualvalue3,D2inthiscase.
AND()andOR()functions
TospecifymultipleconditionswithinanIF()function,useExcel'sAND()andOR()functions.
=AND(condition1,condition2,...conditionn)
=OR(condition1,condition2,...conditionn)
AND( ) returns the value of TRUE if all its conditions are true, and returns FALSE otherwise.OR( )
returnsTRUEifatleastoneofthespecifiedconditionsistrue.
Note:ISBLANK(
)function
tests
whether
acertain
cell
is
blank.
This
function
returns
TRUE
ifthe
cell
is
blankandFALSEifitsnot.
-
8/12/2019 Handouts Excel
17/27
17 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
Themodifiedformulawouldthenbe:
=IF(AND(D2>E2,NOT(ISBLANK(D2))),D2 , (D2+E2)/2)
The firstargumentofthe IF( ) function isaAND( ) functionthattestsbothconditions, Improvement
Test 3 is greater than Test 3 and Test 3 isnot blank. If both conditions are true, then the second
calculationisperformed,elsethecalculationinthethirdargumentisperformed.
Cuttingup&PiecingtogetherTextStringsusingTextfunctions
Function WhatitDoes
CONCATENATEJoinstogethertwoormoretextstrings=CONCATENATE(A2,B2)
LEFT
Returnsaspecifiednumberofcharactersfromthestart
ofasuppliedtextstring=LEFT(C2,8)
MID
Returnsaspecifiednumberofcharactersfromthemiddle
ofasuppliedtextstring
=MID(A2,2,2)
RIGHT
Returnsaspecifiednumberofcharactersfromtheendof
asuppliedtextstring=RIGHT(A2,3)
REPT
Returnsastringconsistingofasuppliedtextstring,
repeatedaspecifiednumberoftimes=REPT(A2,3)
LENReturnsthelengthofasuppliedtextstring=LEN(A2)
EXACT
Testsiftwosuppliedtextstringsareexactlythesameand
ifso,returnsTRUE;Otherwise,returnsFALSE.=EXACT(A2,F2)
MATCH Returns
the
relative
position
of
an
item
in
an
array
that
matchesthespecifiedvalueinaspecifiedorder.=MATCH(D2,$D$2:D2,0)
-
8/12/2019 Handouts Excel
18/27
-
8/12/2019 Handouts Excel
19/27
19 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
1. IntheLookup_value(first)argumentbox,selectcellA4(thevalueforwhichthecalculation ismade).
2. SelecttheTable_array (second)argumentbox;usetheseparatetablethathasbeencreatedearlier. In our example, the lookup table is in 'PartsList'!A2:D11. Look up table has been
created intheworksheetnamedPartsListand is inthecolumnsA2toD11.Nowadjustthe
formulasuchthatthetablearraybecomesanabsolutereference,'PartsList'!$A$2:$D$11.
3. In theCol_Index_num (third) argument box, type in the number of the column in thedatatable. A Col_index_num of 1 returns the value in the 1st column in table_array; a
Col_index_num of 2 returns the value in the 2nd column in table_array and so on. In this
example,weareusingthe2nd
column,hencethevalueis2
4. Range_lookupcanbeeithera0or1,elseyoucoulduseTRUEorFALSE. Ifanexactmatch isneeded,choose0orTRUE.Bydefault,itissetasTRUE.
5. Hence,thelookupfunctiontogetdetailsofaparticularpartnumberwillbe:=VLOOKUP(A4,Lookup!$A$2:$D$11,2,TRUE)
6. Checkiftheresultisasexpected,andthenclickOK.
-
8/12/2019 Handouts Excel
20/27
20 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
PivotTables
ThePivottablesinExcelareveryusefulandpowerfulfeatureandcanbeusedtosummarize,analyse,
exploreandpresentyourdatawithease.
PivotTablereportisespeciallydesignedfor:
Queryinglargeamountsofdata Subtotalling and aggregating numeric data, i.e., summarising data by categories andsubcategories,andcreatingcustomcalculationsandformulas. Expandingandcollapsinglevelsofdatatofocusyourresults,anddrillingdowntodetailsfrom
thesummarydataforareasofinteresttoyou.
Transposingdatamovingrowstocolumnsorcolumnstorows(or"pivoting")toseedifferentsummariesofthesourcedata.
Filtering,sorting,grouping,andconditionallyformattingthemostusefulandinterestingsubsetofdatatoenableyoutofocusontheinformationthatyouwant,withouthavingtowriteany
formulas
Presentingconcise,attractive,andannotatedonlineorprintedreports.
CreateaPivotTable
from
worksheet
data
WhenyoucreateaPivotTablereportfromworksheetdata,thatdatabecomesthesourcedataforthe
PivotTablereport.
1. Selecttherangeofcellsthatcontainsthedataalongwithcolumnheadings.2. OntheInserttab,intheTablesgroup,clickPivotTable.3. TheCreatePivotTabledialogboxisopen.
4. UnderChoose thedata thatyouwanttoanalyze,makesurethatSelecta tableorrange isselected,andthenintheTable/Rangebox,makesuretherangeofcellsthatyouwanttouseis
listed.
5. UnderChoosewhereyouwant thePivotTable report tobeplaced, choose either theNewWorksheetorExistingWorksheetandclickOK.
-
8/12/2019 Handouts Excel
21/27
-
8/12/2019 Handouts Excel
22/27
22 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
MEDIAN(range) Returnsthenumberinthemiddleofarangeofdata
MODE(range)Returnsthemostfrequentlyoccurringorrepetitivevalue
inarangeofdata
COUNT(range) Countshowmanynumbersareinarangeofdata
COUNTA(range) Countshowmanyvaluesareinarangeofdata
MAX(range)
Returnsthe
maximum
value
of
arange
MIN(range) Returnstheminimumvalueofarange
LARGE(range,n) Returnsthekthlargestvalueinadataset
SMALL(range,n) Returnsthekthsmallestvalueinadataset
WewillusethefamiliarexampleofaclassgradestoillustratetheuseofsomeofthemorebasicExcel
functions,likeAVERAGE(),MODE()ANDMAX().Assumeaclasssgradedistributionisasfollows:3,0,
4,4,4,2,4,1,4,0,3,3,1,1,3,4,2,4,0,3,3,1,3.Thesegradesarebasedona4pointscalewith4=A
and0=F.UsingtheAVERAGE( ) function,we find theclass's average (orarithmeticmean)grade is a
disappointing 2.48, or a midC. The syntax for this common function is =AVERAGE(number1,
number2,
...).
However,
we
don't
get
a
clear
picture
of
the
classs
performance
by
simply
looking
at
its
average.WecanfurtheranalyzethedatausingtheMEDIAN()function.Themediangivesthemiddle
numberinasetofnumbersanditssyntaxis=MEDIAN(number1,number2,...).Whenthemediangrade
iscalculated,itis3.0,meaningthathalfofthegradesarehigherthan3.0,andhalfarelower.Therefore,
despitethelowclassaverage,morestudentsscored3'sand4'sthan2's,1'sand0's.
Additionally,wecanalsoanalyzethegradedistributionbyusingtheMODE()function.Themodegives
the most frequently occurring value of a set of numbers and its syntax is =MODE(number1,
number2,...).Excel'sbuiltinfunctionstodeterminethenumberofgradesentered,andthemaximum
andminimumgradesofthedistribution.
AVERAGEandAVERAGEA
ThedifferencebetweenAVERAGEandAVERAGEAbecomesevidentwhenoneofthecellscontainsa
textORASPACEanddon'tforgettheSPACE.AcellcontainingaspaceisNOTempty.
COUNTandCOUNTA
IfyouwanttocountthenumberofcellsthatarenotblankCOUNTandCOUNTAwillreturnadifferent
resultifinoneofthecellsthereisatextoraspace
=COUNT(B2:B7)willreturn6isonlynumbersarepresentincellsB2toB7and5ifthereisaletter,
anemptycellORASPACEinoneofthecells.
=COUNTA(B2:B7) will return 6 unless one of the cells is empty. If all the cells contain numbers,
lettersORSPACEStheresultwillbe6.
-
8/12/2019 Handouts Excel
23/27
23 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
LARGEandSMALL
TheMAXandMINfunctionswouldgivethelargestandsmallestvaluefromalistofvalues.Butwhatif
you want the second or third largest value or the second smallest value, use LARGE and SMALL
functionsasfollows:=LARGE(A1:A5,2), =LARGE(A1:A5,3), =SMALL(A1:A5,2)
Asamatter
of
factsyou
can
also
get
the
MIN
and
MAX
values
using
these
functions.
=LARGE(A1:A5,1), =SMALL(A1:A5,1)
Linearregressionfunctions
Excel has some builtin functions that allow a method for determining the slope, yintercept,
correlationcoefficient,andRsquaredvaluesofasetofdata.ThefunctionsareSLOPE(),INTERCEPT(),
andCORREL(). These functionsareeasierand faster tocomputethanplotting thedata.However,a
visualgraphshowstrendsinthedatabetterthananyothertool.
Function WhatitDoes
SLOPE Returnstheslopeoftheregressionlinethroughthegiven
datapoints
=SLOPE(ycellrange,xcellrange)=SLOPE(C2:C6,A2:A6)
INTERCEPT Calculates thepointatwhicha linewill intersect they
axis using a bestfit regression line plotted through the
knownxvaluesandyvalues
=INTERCEPT(ycellrange,xcellrange)=INTERCEPT(C2:C6,A2:A6)
CORREL Returnthecorrelationcoefficientbetweentwodatasets.
=CORREL(ycellrange,xcellrange)
Ifwe
consider
the
example
of
acar
in
motion
that
is
coming
to
astop
and
are
required
to
determine
its
accelerationand initialvelocity.Then,wecandeterminethecar'saccelerationand its initialvelocity
withthehelpoftheSLOPE()andINTERCEPT()functions.Hence,theyaxisvaluesrepresentthesquare
ofthecar'svelocityandthexaxisvaluesrepresentthecarspositionordistancetravelled.Inorderto
findtheacceleration,wedividetheslopeby2andtofindtheinitialvelocity,wetakethesquarerootof
theyintercept.
Distancetravelled
(inm)
Velocity
(inm/s)
SquareofVelocity
inm2/s2
2.00 6.90 47.61
4.00 6.00 36.00
6.00 4.90 24.01
8.00
3.40
11.56
10.00 0.00 0.00
TheCORREL()functioncanthenbeusedtoensurethatthedatadisplaysalineartrend.Itisalwaysa
good ideatoplotthedataaswellasusethesestatisticsfunctionsbecausesometimestrendsarenot
obvious.Additionally,aplotofthedataallowsustovisualizethedataandgrossblundersanderrant
datapointsareeasilydetected.
-
8/12/2019 Handouts Excel
24/27
24 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
STDEV
For error analysis, we use the STDEV function. When we carry out a number of repetitive
measurementsofonequantity,wefindtheaveragevalue.Thisdoesnothowevertellusanythingof
theprecisionofourmeasurement.Thestandarddeviationofthemeasuredvalueswillgiveameasure
oftheprecision.Toquicklydeterminethestandarddeviationofanymeasurement,useExcel'sbuiltin
STDEV()function.=STDEV(A2:A6)
StatisticalAnalysis
MicrosoftExcelhasnumerousAddinfeaturesthatsupportstatisticalanalysis.Statisticaldataanalysis
in Excel is not recommended for analysing datasetswith a large sample size or a large number of
variables,performingadvanced statisticalanalyses,or forprojects inwhichanumberofprocedures
needtobeperformed. Excel isausefultool foransweringbasicanalysis.Theprimaryreasontouse
Excelforstatisticaldataanalysisisbecauseitissowidelyavailable.
ThereareanumberofdisadvantagesworthconsideringbeforeusingExcelforstatisticalanalysis:
Missingvaluesarehandledinconsistently,andsometimesincorrectly. Datahastobeorganiseddifferentlyaccordingtotheanalysisyouwishtoperform. Mostanalysescanonlybedoneononecolumnatatime.Thismakesitinconvenienttodothe
sameanalysisonmanycolumns.
Thereisnologorrecordofhowananalysiswasaccomplished. Italsolacksmanyimportantfeaturesforadvancedanalyses.
UsingtheAnalysisToolPak
Two
specific
tools
are
useful
in
generating
descriptive
statistics
and
histograms
of
grade
distributions.
Toaccessthesefeatures,theAnalysisToolPakmustbeloaded.
Checktosee iftheDataAnalysiscommand isavailable intheAnalysisgroupontheDatatab. Ifthe
DataAnalysismenuisavailable,thenitindicatesthattheAnalysisToolPakisalreadyloaded.
Ifthemenuisnotvisible,then
1. ChooseAddInsfromtheExcelOptionsfoundthroughtheMicrosoftOfficeButton.
-
8/12/2019 Handouts Excel
25/27
25 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
2. IntheManagedropdownmenu,selectExcelAddins,andclickGo.
3. IntheAddInsavailablebox,selecttheAnalysisToolPakcheckbox,andthenclickOK.4. IfyougetpromptedthattheAnalysisToolPakisnotcurrentlyinstalledonyourcomputer,click
Yestoinstallit.
5. A configuration progress screen for Microsoft Office appears and once completed, theDataAnalysismenushouldappearontheDatamenuintheAnalysisgroup.
DescriptiveStatistics
Thequickestwaytogetmeanandstandarddeviation foranentiregroup isbyusingtheDescriptive
Statistics in theDataAnalysis tools.Thisgenerates simpledescriptivestatistics likeaverage,median,
-
8/12/2019 Handouts Excel
26/27
26 FormulasandFunctionswithExcelKiruthikaRagupathi,email:[email protected]
andstandarddeviationforacollectionofdata.YoucanchooseseveraladjacentcolumnsfortheInput
Rangeandeachcolumnisanalysedseparately.Thelabelsinthefirstrowareusedtolabeltheoutput,
andtheemptycellsareignored.Iftherearemorenonadjacentcolumnstobeanalysed,thenonehas
to repeat the process for each group of adjacent columns. The procedure is straightforward, can
managemanycolumnsreasonablyefficiently,andemptycellsaretreatedproperly.Togeneratethese
statistics,
1. FromtheDatamenuintheAnalysisgroup,selectDataAnalysis.
2. TheDataAnalysisdialogboxopens.
3. IntheDataAnalysisdialogbox,chooseDescriptiveStatistics.4. IntheDescriptiveStatisticsdialogbox(seebelow),specifythecellsthatcontainyourdata in
theInputRangebox.SelecttheSummaryStatisticscheckboxinthelowerleftcorner.
5. Bydefault,thestatisticsisgeneratedonanewworksheet.Ifyouwantthestatisticstoappearonthesameworksheet,clicktheOutputRangebuttonandspecifyadestinationcell forthe
statistics.Youcanalsospecifyanameforthenewworksheet.
-
8/12/2019 Handouts Excel
27/27
27 Formulas and Functions with Excel
SampleoutputfromtheDescriptiveStatisticstoolappearsasshowninthetablebelow.
MeasuredValuesMean 343.491
StandardError 0.666719
Median
344Mode 344
StandardDeviation 2.981658
SampleVariance 8.890283
Kurtosis 1.775491
Skewness 1.22725
Range 12.17
Minimum 335.53
Maximum 347.7
Sum 6869.82
Count 20
Largest(1)
347.7Smallest(1) 335.53
ConfidenceLevel(95.0%) 1.395459
Note:
Skewness isameasureofsymmetry,ormoreprecisely, the lackofsymmetry.Adistribution, ordataset, is symmetric if it
looksthesametotheleftandrightofthecenterpoint.Kurtosisisameasureofwhetherthedataarepeakedorflatrelativeto
anormaldistribution.
MoreInformation
ExcelHelp
ExcelhasaHelpsystembuilt intothesoftware.Youcanclickon atanytimeandbrowsethrough
thetopicsforyourspecifictopicorcansearchforitusingthesearchoption.Togethelpwithaspecific
procedure,clickontheHelponthisfunctionintheDialogboxfortheprocedureyouwouldliketorun.
Officeonline
MicrosoftalsooffersaverycomprehensiveonlinehelpattheMicrosoftoffice Help forExcel2007,
http://office.microsoft.com/enus/excel/FX100646951033.aspx?CTT=96&Origin=CL100570551033