IF function
+ Show All
Tsar descites the fam syiaxand usage ofthe funcon in Mizosott Excel.
Description
The funcon returns one vale aconton you sped eves to TRIE, and another value if that condtion evaluates to FALSE. Fr exam the formula =F
{At>10Over 10,10 orles"retuns “Over 10° iA is rater than 10, and “10 or esi As es than or equa 10
Syntax
Tetlogical_test, (value if true], [value it falsel)
The fnconsyta asthe folowing arguments
* Logical test Requied. Any vue or expression that can be eae to TRUE or FASE For exam, ATO=100 logical exprssonfthe value in cel A10
«qua to 100, the expresion evans o TRUE. Others, the expression evaluates to FALSE This xgument an use any compatson action opera.
* Value true Optional The value that you want to be retuned ifthe logical test argent evaluates to TRUE. For example the vale of this arguments the
text sting" Witin budget’ and the logical fest argument evaluates to TRUE, the IF furction returns the txt "Win budge iol test evaluates to TRUE
anc the value i true agumentis omit thats, theres on a comma following the logical ts xgument te IF uncon etuns (2x0, To displ the
word TRUE use the logical value TRUE forthe wolue if true rgument.+ Value if false Optional The value that you want o be retuned he logical test xgument evaluates to FASE. Fr example ifthe value ofthis argument is
the et sting “Over budget” andthe logical est argument evaluates to FALSE the If function retus the tet "Over budget” logical test evaluates to FALSE
and the valu f false arguments oid, (hati, theres no comme folowing the vale if rue argument, th function retus the logical valu FALSE.
logical test evaluates to FALSE and the vlue of th value false arguments blank thats, theres only comma folowing the value true argument the IE
function tums the value O ro).
Remarks
* Upto 64 IF functions can be nested as Value if true and Value f fle arguments to construct more elaborate tests. See ample 3 fora sample of nested IF
functions) Asatve, to test many conditions, consider sing the LOOKUP, VIOOKUP,HLOOKUP, or CHOOSE funcons. (Se Example for a sample ofthe
LOOKUP function)
+ Hfany ofthe arguments oIFae ays evry cement othe aay is evaluated when the I stlementis cried out
* Excel provides atonal fnctons that canbe use to analyze your data based on a condition For example to count the numberof ocuences oa sting of
tert ora number within range of ces, use the COUNTI or the COUNTIES worksheet functions To calculate asum based on sting of texto a number win
a renga, se the SUMIF othe SUMIFS worksheet undions
xamples
Copy the example data in th folowing tbl and past tin cell At of anew Excel worksheet. For formulas to show resus set them, press 2, nd then press
Ents you need to. you cn ads th column widths to see al the data,
Data
0 2 SUSFormula Resit
=1F|A2c=100"Witin budge’ "Over budger) ifthe rumberin cel isles than req 0100, at et
‘the formula returns "Within budget Others the *
function dps “Cer budget”
2100 42-82") Ifthe number incel As equal to 100, A2+B2is 0
Called and retuned. Othe, empty ext ("is
retuned.
2B <1-049) Ite eutis Fae and nov fale argument is FASE
roid forthe Fae rest FASE retumed.
The suit is Fase anda blank value false
arguments provided forthe Fe res a comma
folows the vate if tre argument}, Os relumed.
EXAMPLE
‘ual Epeses Prete Expenses
$1,500, $900
sso co)
$500 $925=F(\2>-82Over Budget")
=FA3> 13 Orr Budge’ -OK)
EXAMPLE 3
Formula
(288A (A> 78°82 69°C IF
(2559-0,
=IFS>89°AIF(A3> 7978 FAB>EBCF
(9-0,
IR 894 IF M> 79°86 CF
(59-0,
45
8
veoupoon neu
Checks wheter actual expenses in raw 2 are reaer Over Budget
than pected eipenses,Retums "Over Budget”
because theres ofthe fests Tue
(Checks wheter actual expenses in ow 3tereaer OK)
than preiced expenses, Reus "OK" because the
result ofthe testis Fae,
Desaption Rest
Uses nested IF conditions to assign alter grade to F
the scorein cel AZ
Uses nested IF conditions to asign alter grade to A
the scarein cel AR.
Uses nested IF conditions to assign alter grade fo
the corein cal AdEXAMPLE
Formula
=LOOKUPIA2 (0606367, 70737788387 908390,
(PADS DyD CCC BB BoA.
‘be
=LOOKUP(A3 0.650 6367, 7073778083 57,9093.7,
(PSD DDC COBB BA
‘AD
-=LOOKUPIA (0.60 6367,70737788347909397,
(PDA DDC CCH BBY BEA
Ae"
Instead of using multiple rested IF funtion, the
formula uses the LOOKUP function onda eter
jade that corresponds oa numeric scr stored in
anata inthe fala
Instead of sng maliple nested Functions, the
fox uses the LOOKUP function ond ater
‘ade that oesponds to a numer score stored in
‘an aay inthe formula.
Instead of using multiple rested IF functions, the
formula uses the LOOKUP function onda eter
rade that corespands oa numeric score stored in
an aay in he formula,
GTRUE
Formula
=SUMB,2)
=SUMPS', 15, TRUE)
=SUMIAZA)
=SUMIAZAA, 19)
=SUMSAB,2)
Descion Result
‘dds 3 and 2
‘Adds 5,18 and 1. The tet valu Sis fist tansated
into a numbes, and the logical vue TRUE sist
trast into the number 1
Add the values in cel 2 through Aa
Add the values in cel 2 through 44a then adds
15to that eu
Add the values in cel AS and A and then ads 2to
that rest Because non-numeric ales in ferences
axe not tanlated — the valence AS (5) and the
‘ue in cel A (TRUE) are bot treated as tet — the
‘lus in thse cls ae ignored.
aRANK.AVG function
+ Show Al
This atc dscbesthefxmula syntax and usage ofthe RANKAVG function in Mizosolt xe
Description
Retus the rarkof a number in fst of umber its eet ther values inthe ti mre than one value asthe same rank the aveagerankis tured
Syntax
HANK. AVG (number, ref, [order])
The RANK funn syntax has the following axgunents:
* Number Reed The number whose rank you want find,
+ Ref Requited.Anaray of or reer to, alist of numbers. Nonnumeic ves in ef ar ignored.
+ Order Optional A number speiing how to rank rumba
Remarks
+ Orders 0 ta) or omit, re ans number site were aft sorted in descending ode
+ Orders any nonzero a, ice ranks number asf ref were alist sorted in ascending odeample
Copy the earle data the following table nd paste itin cl At ofa new Excel worksheet. For fouls to show sits, selec them press F2, and then press
Ener you nead to, you con adjust the colura widths to seal the data.
Day Temp ()
eon 8
TRON 8
0 2
T2011 101
5/2011 4
76/2011 7
Tapeon 6
Formula Description Rest
=RANKAVG(S4.B2:88) Finds the rank (the position) of the value 34 in the cell 4
range B28 In this case, 75/1, hen the
temperature reached, was the ath hotest day of
the days.
To work more in-depth wih the example datain Excel downlad the embedded workbook to your computer, and then open tin Excel.IPE function
+ Show All
This artic describes the formula syntax and usage ofthe TYPE funcion in Microsoft Exe
Description
Returns the type of value Use TYPE when the behavior of another function depends onthe type of valein a partculr cel
‘The TYPE function sytac has the following arguments:
* Value Requited. Can be ay Mizosot Ex valu, such asa number, tet lagi vl, and so.
(en re
Number
Text
Logical ae
for valve
le el ~ iy -ample
Copy te example dain th flowing table, and past tin cll At ofa nen Exc rsh. For frmus to hom sults set then pes, and then press
Fre: you eet, you cn asthe col widths to seal the data
=TVPER#AR
=A)
=TPE(f1234)
Descintion
Retums the type of the value in A2 The Txt type is
indicated by 2
Retumsthe ype of Me, Sith hich set.
Retums the type of the formula in C6, wich retums
16 the type fr the enor message VALUE! The enor
message 2VALUE!%s shown in C7,
‘The error value returned by the formula =(2+A2},
hich s used in C2,
Retuns the fp oan aay constant wichVLOOKUP function
+Show All
‘Tis ate descibes the formu sya and usage ofthe VLOQKUP uncon n Microsoft Exe
Description
‘You can use the VLOOKUP function to search the fist column of range of ll, and then return value fom any cell onthe same row ofthe ange. Fo example,
suppose that you havea lis of employees conanedin the ange AZO. The employes’ ID numbers ae stored in heist col of the ange as shown the
folowing ilustation
If you know the employees ID number, you can wse the VLOOKUP function oretunethe the department or the name ofthat employe. To obtain the name of
employe number 38, you cn use the formula "VLOOKUPE3, A210, 3, FALSE). This forma searches forthe value 38 inthe fist column ofthe range ACI, nd
then ret the vale thal is cotane in the hd column ofthe ange and onthe same ow asthe lokup vale (Ae Delgado".The Vin LOOKUP stands for vec Use LOOKUP instead of LOOKUP he your comparson vs ae lactedn aclu to th et of the data tht you
‘want to find.
Syntax
‘VLOORUP (lookup value, table array, col index nom, [range lookup]})
The VLOOKUP function sya asthe flowing exqumets:
* lookup value Required. The vat searchin the fist colmn of thetble range The lokup vu gure canbe a vale or a reference. the valve you
supply forthe look vale arguent ssl than the smaes value inthe fst con of the teble aay xquret VLOOKUPretunsthe ANIA eno va
+ table aay Requte,Therange of els that contains the data, You cn use areeence to range for example, ADB or ange name The ves in the fist
alu of tbe aay ae th values searched by look vl These vals canbe tet, numbers ological values, Uppercase andloerase tert ae
equivalent
+ colindex um Requied The column umber the tbl ray axgurent fram wich the mating value mast be retuned col inde ur aguret of 1
‘etusthevavein the fist countable ray, cl inde um of 2 tus the valu inthe second clu in table ory, and soon
ithe col index um axguetis:
+ Lessthan , VOOKUPretuns the #VALUE! eo va
* Greate than the number of colurs in table array, VLOOKUP retuns the #REF! enor value.+ range lookup Optional. logical value that specs whether you want VLOOKUPto fed an rat match ran approximate mac
+ range loops eter TRUE ois omited, n etc or approximate match retuned. an eat match snot found the net largest value thats ss
than loka values tured.
INPORTANT If rong lookups ther TRUE ois ote, the values in the fist column of table array must be placed in ascending sor order these, VLOOKUP
right nt retun the coed value
For moreinfomaton se Sort data ina ange ortable.
range lookup is FASE, the vues inthe fist cl of able aray donot ned tobe sorted.
+ the range lookp arguments FALSE VUOOKUP wind onan exact mach thee axe two o moce values in the fist clu of table aay tat match the
lookup value, the fist vue found is used. fan exact match sot found the err vale A retuned,
Remarks
* When seachng tet ves inthe fist column fable array ens that the data inthe fst clun of table aay doesnot contin eaing spaces, traling
spaces, consistent se of stg (‘or and cary (or) quotation mas, ornonpitng characters. n these cases, VLOOKUP might ret an inca or
needed va
For moreinformaton se CLEAN uncon and TRIM function
* When searching number r date values, ensure tha th detain theft coh of table ara ot stored as te valus. nis case, VLOOKUP might etm
anincoect or unepaced va.
+ Henge Jokup is FASE ar lok vest. you canusethewilcard characters — the question ma) and atrsk)— in olup value. question
rack matches ny single chat nastris matches ny sequence of chats you want to fd an actual question mark or asters type tide =)
preceding the characterfxample
ony the example data in the folowing table, and paste itn cellA1 of anew Excel worksheet. For formals to show rests, elect them, res F2, and then press
Enis If you need to, you can adjust the column width to seal the dat,
Density
Formula
VLOOKUP(,AZCIO2}
=VLOOKUP(/AZCIO3TRUE)
04s?
0525
606
ass
as
as
a6
108
123
Viscosity
358
325
293
278
2sr
238
2a
135
wm
Desciption
Using an agprsimate match searches forthe ae
in column A, inds the largest ve les than or equal
to inclu A which 0.45 and then retursthe
value rom column Bin the sane row
Using an approximate match, searches forthe value 1
in coum nds the gest va stan or equal
to inesumn A wich 0465, and hen tus the
‘ale fom cluna in the same ow
Tempeatue
@lceaueeas
DIT
‘00-=VLOOKUPIO7 A203 FALSE)
-=VLODKURO:LAZCIN2 TRUE)
=VLOOKUP2A2C10.2 TRUE)
EXAMPLE 2
5340
aLS6r
128
wi
18.469
Formula
= VLOOKUP('D1326 A2DE, 3 FALSE]*
(1+ WooKuerL 328, A208, 4,
Fase)
Using an exact match, searches forthe value 07 in
coum A Because thee no erat match n chu,
Aan enor relumed.
sing an aproximate match, searches forthe lve
(in coun A Because 0. ess than the smast
vale incu Aan erreur,
Using an approximate match, seatces forthe value 2
in column nds te largest vale les thon or equal
02m calumn , which s 1.29, and then eturs the
‘alu fom colurn in these om,
tem cost
Stole
sib
Diopets
‘Wipes
sitar
Description
Calculates the retail price of diapers by
axing the matup percentage tothe
cost
aA
ANA
wn
Marup
sser 30%
356 4%
S145 28%
ssn 40%
$256 5%
Result
2696= (VLOOKUPT WISE, AZDS, 3, FALSE)
* (+ VooKUPrWs8e", A206, 4,
False) *(1- 20%)
MLOOKUPA2, AZDS, 3, FALSE) >=
20 "Natkupis* & 100* LOOKUP
2D; 4 FALSE) "Costs under
aco
Markup is" &100* VLOOKUPAS,
‘A2DI 4 FALSE) AY, "Costs $e
YUOOKUPIAS, 42:06, 3, FALSE)
EXAMPLES
z
alates the sale pce of wipes by 3823
‘subtracting aspect discount fom
‘the etal price,
the cst ofan item i greater than or
equal to $20.00, spas the
sting “Marlup isn otherwise,
Aislays the ing "Costs unde $20.00"
Ifthe cost of an item s greater than or
equal to $20.00, displays the ting
Narlup isn’ othense splays the
‘ting "Costs Snan™
Markup 30%
Costs $356
Firstname Tile
sea Sales Rp,
Karina Sales Rep.
Michae!
i
t
of
8988
2ngnss2
anys
sn9n358
yayis5s
TRAate ana spas ne es 2s
an integer using the INT
‘uncon.
-=IFISNAMLOOKUP Ithereis an employee with an Burke
(Gazer Z FALSE) IDF, dsplaysthe employee's
TRUE, "Employee not found’, lst nae; others, displays
WLOOKUPSAZETZFALSE) the message “Employee not
foun.
“The ISNA function retusa
‘TRUE value when the
‘LOOKUP function returns the
2A enor vue,
=SIFISNAMLOOKUP there san employee with an Employee not found
(IS AsEB2FALSE) = 1D of 15, deplays the
TRUE “Employee not fund’, employees ast name,
‘VLOOKUPIISAEB2FALSE) —othertse dplaysthe
‘message "Employee nat found
‘tha SNA function retusa
“TRUEvalue when the
‘LOOKUP function retums the
N/A or value
VLOOKUP(4AZET3FAISE) Far the employe wth an 1D of
8° B.VLOOKUP 4,concatenates (combines) the
GARET2FALSE| Aisa" & —valuesof three cls into a
VLOOKUPAZETA FALSE) complet sentenceThis atc describes the formula syntax and usage ofthe ROWS fucionin Mcasot Excel
Description
Reluns the numberof rowsina efrence ray.
Syntax
Rows (array)
The ROWS function syntax has the folowing argument
+ Aray. Rested. An aay, an aay formula or a eferenceto a ange of ls for which you want the numberof ows.
Example
Copy the example data inthe folowing table, and paste itn cel tof anew Excel wotsheet. For fms to show ests sl them, press F2 and then press
Enter you need to, you cn ads the col widths to see al the data
Formula Decision Result
=ROWSICLES) Number of owsin the reference 4
=ROWSIL23456) Number of rousin the aay constant 2OFFSET function
“Show Al
‘This ate dascbes the ful syntax and usage ofthe OFFSET function in Microsoft Exe.
Description
Retums reference to arange thats aspect number of rows and columns rom a ellor ange of ces. The reference thats retured can bea single cell or range
of els Yu can specy the numberof rows andthe number of columns tobe returned
Syntax
OnFset(zeference, rows, cols, [height], [widthl)
The OFFSET function syntax asthe following arguments:
+ Reference Requied. Te ference fom which you want to ase the offset Reference must eer toa cell orange of adjacent cls otherwise, OFFSET retus
the VALUE! err value.
* Rows Required. The number of rs, up or down, that you want the upper cl to feo, Using 5 asthe roms argument species thatthe upper-left cel
inthe reference’ five roms below reference. Rows can be postive (ich means below the stating reference) or negative (hich means above the starting
reference
* Cols Required. The number of columns, to theft og, that you want the upper cel ofthe resut to refer to, Using 5 asthe cos argument species
thatthe upper-eft clin the reference sive columns to the right of reference. Cols an be postive (hich means tothe ight of the stating reference) or
negative (hich means to the let ofthe starting reference.
* Height Optional The height in numberof ows, that you wan the retuned reference tobe. Height must bea postive number.* Width Optional. The width, i numberof colums, that you want the returned reference to be Width must bea postive umber.
Remarks:
+ Irons and cols offset eference ovr the edge of the worksheet, OFFSET relums the AREF etror vale.
* I eight or width is omitted tis assumed tobe the same eight or width as reference.
* OFFSET does actualy mae any cls or change the ection: itjust tus a eerence. OFFSET can be used wth any function expecting a reference
argument. Fr example the formala SUMIOFFSET(C2.1.231)calaates the total value ofa 3-1 by 1-ohumn ange thats row below and 2 cols to the
fight of cell C2
Example
Copy the example data inthe following table, and paste el A of w new Excel worksheet. For formuls to show results select them press F2, and then press
Enter. you need to, you can adjust the column widths to see al the data
Formula Descipton Result
OFFSETIDS3-21.1) Disp the valu incl 864) 4
=SUM(OFESETID3#53,2, 3,3) Sums the rnge BCA 4
OFFSETS, 3-3) Retums an err, because the referenceisto a non-#REFL
cstat range onthe wotsheet.
Data Data
4
8
3MATCH function
+ Show Al
‘This are describes the formule syntax and usage af the MATCH function in Microsoft Excel,
Description
‘The MATCH function searches fora speed item in a range of els, and then returns the reave poston ofthat item nthe ange For ramp the ange ATAB
contains the values, 25, and 38 then the formula
=MATCH5A1A3 0)
retums the number 2, because 25 the sacond itm in the rang.
Use MATCH instead of one ofthe LOOKUP functions when you ned the postion of an item in a ange instead of the itom sl. For example you might use the
[MATCH function to provide a vale fo the row num argument ofthe INDEX function.
Syntax
MICH Iookup_value, lookup array, [match tyre])
‘The MATCH function syntax has the folowing acu:
+ lookup value Required. The value that you vant to matchinlolap array For example, when you lockup someane's number in telephone book, you are
Using the petson's name asthe lookup val but the telephone numbers the valve you want
The lookup vale argument canbe vaue (umber, tet o logical vate) ora call reference to a number, te, ological va,
+ lookup. array Requited. The range of cls being searched.* match type Optional The number, 0 oF. The match type axqument species how Excel matches lookup vue with values in lolup ara, The default
vee fo this arguments 1
The following table describes how te function nds vues based on the setting ofthe match fpe argument
Match type Behavior
1 or onited [MATCH finds the gest valu that ls than or equal to lookup value. The
‘alsin the lokyp_amay argurent must be placed in ascending order, for
ramps 2, 0,1, 2, AZ, FALSE, TRUE,
0 [MATCH fins the fest valu thats exactly equal ta lookup value. Te values inthe
lookup. any argument canbe in any order.
4 [MATCH finds the smalls value tha is greater than or equa t lookup valu. The
‘alsin the lokup_amay argument mast be placed in descending order, for
example: TRUE, FALSE, ZA «2, 10,1, -2, and soon.
NoTES
* MATCH returns the postion ofthe matched value within lookup array, atthe vai tse: Fr example, MATCH"
‘eave poston of within the aay (2b.
* MATCH does not singuish between uppercase and loners ters when matching tt values.
+ FMATCH is unsucssul in fning a match itretus the N/A or va
+ Hmatch types nd lookup values testing, you can se the wdc characters — the question mark nd aster —in the lookup value
argument. A question mark matches any singe character; an asterisk matches any sequence of characters If you wantto find an actual question mark or
asterisk type tide (+) before the character
"0 tus 2, whichis thetrample
Copy th example dt the flowing tbl, and psteitin cel M of anew cel wrshet Fr formulas to shaw ress sel the pres, andthe ress
Ent. fyou ned to you an aust the column widths ose al te data
Product Count
sananas B
(ranges %
Apes 4
Pears 4
Fomula Desciption Result
=MATOHB9B285,) ‘Because there isnt an exact match the postion of
the nertlowest alu (38m the range B285is
rete.
MAT B285 0) The poston ofthe va inthe range BS
TCHAOBE5.1) Fetus aneorbecusethevauesinthe range NA
1285 aretin denn odeThe LOOKUP function tur 2 value ether from a one-raw arane-column range or rom an aay. The LOOKUP function has two syntax frm: the vctr form and
the aay form.
you want to ‘Then see Usage
eokin aone-row or anecolumn ange crown as Vector orm Use the vctr frm when you hav arg Et ot
‘ecto for value and retum a value from the same values to lok up or when the values may change over
tion in a second one-row or one-