Upload
pram29c
View
216
Download
0
Embed Size (px)
Citation preview
8/17/2019 Excel Formula Tips and Tricks
1/103
Summing Formulas
Excel SUM Formula Probably, the most widely used Excel formula, the SUM function in Excelis specifically designed to add values from different ranges, or one range. The SUM formula can
be typed into a cell in Excel, or inserted via the Insert Function tool to the left of your ormula bar.
Excel SUM Function/Formula. Add Numbers, or a Range of Cells
Wit SUM Formula
Excel's SUM Function. See Also: AutoSum Tips
Using the SUM Function
The SUM function in Excel is specifically designed to add values from different ranges. The
SUM unction can be typed into a cell in Excel, or inserted via the Insert Function tool to theleft of your ormula bar. The syntax of the SUM unction is SUM!number",number#, ...$. SUM
is the function name, and contained within the brac%ets are &arguments&, or the pieces of
information that Excel re'uires to complete the unction. The SUM function allows from " to
() arguments !number ", number ....$ for which you re'uire the total value or SUM.
Using Ctrl to Mark Cells
*f you wish to add cells that are non+contiguous !not oined together$, type in your function
=SUM clic% in the first cell you wish to add. -old down your Ctrl %ey and clic% in all other
cells you wish to add up, then type in a !. Typing in a comma instead of selecting with your Ctrl%ey also wor%s ust as efficiently as well.
Using SUM to A"" a #ange $rom a %i$$erent &orksheet
ou can easily use SUM to add up the same range in different wor%sheets. /lic% in the cell you
want the result of your addition in, then holding down the Shi$t %ey, clic% on the next wor%sheet
that you wish to include in your calculation and highlight the range to be used, then clic% Enter.
0ne thing to note here however, is that if you insert a wor%sheet in the middle of the range that
you have told the SUM function to add, then the same range on that wor%sheet will be includedin your sum.
TI( *f you wish to force any new inserted wor%sheets to be included in the SUM range, try
this. insert a blan% wor%sheet at the beginning of your sheets in your wor%boo%, and a blan%
sheet at the end. 1ow in the cell that you wish the result of your addition to appear in type in
2SUM! and then clic% on the new first blank worksheet and highlight the range you re'uire to be
http://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/autosum.htmhttp://www.ozgrid.com/Excel/autosum.htmhttp://www.ozgrid.com/Excel/Sum.htm
8/17/2019 Excel Formula Tips and Tricks
2/103
added in all wor%sheets. -old down your Shi$t %ey and clic% on the new last blank worksheet ,
then close your brac%et $ and hit enter. 1ow hide the first sheet and the last sheet by going to
ormat3Sheet3-ide. This will force any new wor%sheets to be included in the SUM range as all
new wor%sheets will be between the # blan% ones.
Excel Autosum Function 4ecause adding numbers is probably the most common function thatExcel is used for, Excel has a built+in eature called AutoSum located on the Standard toolbar.
Excel Autosum. Sum u! "alues in Excel Automaticall#Excel's AutoSum Function. See Also: SUM Formula)Function ** Excel AutoSum **
AutoSum Tips + an" AutoSum Tips ,
4ecause adding numbers is probably the most common function that Excel is used for, Excel has
a built+in eature called AutoSum located on the Standard toolbar. AutoSum is represented as
the 5ree% /apital letter Sigma 6. ou can use AutoSum to sum a range of cells. 7 8ange can
be one single cell, or many cells. ou can sum cells in a contiguous !no gaps$ range of cells, or a
non+contiguous !cells not oined together$ range.
To use AutoSum you must clic% in the cell that you wish your result, or addition to appear in.7s a default, AutoSum loo%s up a column for figures immediately above it to add together. This
wor%s great, unless it encounters a blan% row or text. *f it does, then it stops at the last cell with
a number in it. *f there are no numbers above it, AutoSum will automatically go to the left
loo%ing for numbers to add up, but will again stop at a blan% column or text. This is Excel9s
default, but you can easily change it.
http://www.ozgrid.com/Excel/autosum.htmhttp://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/autosum-tips2.htmhttp://www.ozgrid.com/Excel/autosum-tips3.htmhttp://www.ozgrid.com/Excel/autosum-tips3.htmhttp://www.ozgrid.com/Excel/autosum.htmhttp://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/autosum-tips2.htmhttp://www.ozgrid.com/Excel/autosum-tips3.htm
8/17/2019 Excel Formula Tips and Tricks
3/103
The SUM unction is written as 2SUM!number ", number #$. 2 is the trigger to Excel that a
function or formula is following. SUM is the name of the function and !number ", number #$ are
the arguments that the SUM function needs to wor%, or in our case the numbers it is to add up.
:hen you clic% the AutoSum icon, you will see the SUM function written in your cell, with a
mar'uee !floating dotted line$ around what the AutoSum intends to add up. *f the highlighted
range is what you wanted to add up, clic% 0;, if not then change the range you wish to add.
ollowing are three screen shots showing the AutoSum.
AutoSum automatically pic%s up the numbers above it
AutoSum automatically loo%s left for numbers if it encounters no numbers immediately above it,
but numbers to the left.
8/17/2019 Excel Formula Tips and Tricks
4/103
AutoSum automatically stops when it encounters a blan% line, or text in the middle of the range
it is trying to add up.
Arra- Formulas in Excel * strongly suggest you read this veryimportant information on using array formulas in yourspreadsheets. 7rray formulas can let you specify more then onecriteria to Sum, 7verage, /ount etc by. Many examples of how touse them.
Arra# Formulas $ Excel Arra# FormulasShareThis | | Information Helpful? Why Not Donate.
TRY OUT: Smart!"# | $o%e!"# | #naly&er'( |
Do)nloa%er'( | Tra%er'(| More Free Downloads.. "est
!alue: *inan+e Templates "un%le
What are Array Formulas? See Also Alternative
to Array Formulas
Excel 7rray formulas are very powerful and useful formulas that
allow more complex calculations than standard formulas. The
&-elp& in Excel defines them as below
8/17/2019 Excel Formula Tips and Tricks
5/103
"An array formula can perform multiple calculations and then return either a single result or
multiple results. Array formulas act on two or more sets of values known as array arguments."
IMPORTANT - Before we Start
:hen * first discovered array formulas may years ago, * thought * had found the answer to 7==my spreadsheet problems. * Started using them willy nilly an" pai" the the price.
Perhaps the number one rule with arrays is, onl- use them hen nee"e" an" kno hen to use
them. * have seen many users using array formulas in instances when a standard Excel formula
will do the ob !eg> one of the database functions$. Too man- arra- $ormulas &I// slo "on
recalculation0 sa1ing0 opening an" closing.
* have even seen &so called& experienced users recommending them to other Excel users loo%ing
for help on a simple formula. This is usually due to inexperience and?or la@iness. This is very
irresponsible, as the person loo%ing for help will also find themselves using them as their first
port of call. So it is important to %now when to use them and when not to. See E$$icient Excel
Sprea"sheet %esign
*t is fair to say that even my examples below are really an incorrect use of array formulas, but in
the interest of %eeping things simple * have used them.
Array Formula Rules
4efore we show some examples of array formulas it is important to %now A fundamental rules.
• ,a+h ar-ument )ithin an array must hae the same amount of ro%s an% columns.
• You must enter an array /y pushin- Ctrl&Sift&Enter.
• You cannot a%% the 01 2/ra+es3 that surroun% an array yourself4 pushin-Ctrl&Sift&Enter )ill %o this for you.
• You cannot use an array formula on an entire column.
Pet Sho! "#am!le
Suppose -ou ha1e 2 Columns o$ "ata each ith +33 ros.
/olumn 7 is used to %eep trac% of the sex of each dog sold i.e. Male or emale
/olumn 4 is used to %eep trac% of the breed of the dogs sold.
/olumn / is used to %eep trac% of the age of the dogs sold.
/olumn B is used to %eep trac% whether the dog is sterili@ed or not i.e. es or 1o
/olumn E is used to %eep trac% of the cost of the dog sold.
http://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm
8/17/2019 Excel Formula Tips and Tricks
6/103
• To +ount the num/er of male 5oo%les sol%:'SUM(()A)*+)A)*'-Male-()0)*+)0)*'-1oodle-
• To +ount the num/er of male 5oo%les sol% oer 6 years ol%:'SUM(()A)*+)A)*'-Male-()0)*+)0)*'-1oodle-()C)*+)C)*2*
• To -et the total +ost of male Spaniels sol%:'SUM(3F()A)*+)A)*'-Male-,3F()0)*+)0)*'-S!aniel-,)E)*+)E)*,,
• To 7n% out the aera-e a-e of male %o-s sol%:'A"ERA4E(3F()A)*+)A)*'-Male-,)C)*+)C)*
• To 7n% out the aera-e +ost of male %o-s sol% oer 8 years ol%:'A"ERA4E(3F()A)*+)A)*'-Male-,3F()C)*+)C)*2*,)E)*+)E)*
• To 7n% out the 9inimum a-e of %o-s sol% that are sterili&e%:'M3N(3F()5)*+)5)*'-6es-,)C)*+)C)*
7ll the above formulas must be entered with Ctrl4Shi$t4Enter
TIP: *f you are having problems writing an array formula to sum your totals then use the
/onditional sum wi@ard, Tool5&i6ar"5Con"itional sum. *f you don9t see it then you will need
to add it via Tools5A""7ins5Con"itional sum i6ar".
:hile using array formulas can be very handy they have one draw bac% and that is, too man- o$
them ithin -our ork8ook &I// slo "on Excels recalculations . *f you have read and
understood the very real pit+falls to using them * highly recommend ta%ing the next step and
going here < 4ut please %eep in mind what * have said here.
Excel Con"itional Sum &i6ar" The /onditional Sum :i@ard is an 7dd+*n to Excel that is usedto summari@e values in a list based on set criteria.
Summing b# More 7an 8 Criteria
Current Special( /omplete Excel Excel Training /ourse for Excel CD + Excel #))(, only "AF.)).
FC.CF *nstant 4uy?Bownload, ,3 %a- Mone- 9ack uarantee G ree Excel -elp for =*EH
5ot any Excel IuestionsJ Free Excel ;elp . See Also: Sum &ith Multiple Criteria an"
Count &ith Multiple Criteria
Excel Sum &i6ar"
http://www.emailoffice.com/excel/arrays-bobumlas.htmlhttp://www.ozgrid.com/Excel/sum-wizard.htmhttp://www.ozgrid.com/Excel/sum-wizard.htmhttp://www.ozgrid.com/Training/complete-excel-course.htmhttp://www.ozgrid.com/Training/complete-excel-course.htmhttps://www.regnow.com/softsell/nph-softsell.cgi?currency=USD&item=7924-16http://www.ozgrid.com/forum/http://www.ozgrid.com/forum/http://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.emailoffice.com/excel/arrays-bobumlas.htmlhttp://www.ozgrid.com/Excel/sum-wizard.htmhttp://www.ozgrid.com/Training/complete-excel-course.htmhttps://www.regnow.com/softsell/nph-softsell.cgi?currency=USD&item=7924-16http://www.ozgrid.com/forum/http://www.ozgrid.com/forum/http://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/count-if.htm
8/17/2019 Excel Formula Tips and Tricks
7/103
The Con"itional Sum &i6ar" is an 7dd+*n to Excel that is used to summarise values in a list
based on set criteria. 7n example of how the /onditional Sum :i@ard can be used is on a list of
data that contains bas%etball teams and number of points scored over a period of time. 4y using
the /onditional Sum :i@ard you can create a formula to add the total points for a team over a
specified period.
4ecause the /onditional Sum :i@ard is an 7dd+*n to Excel, you will need to install it !you may
need your 0ffice dis% to do this$. To install the /onditional Sum :i@ard go to Tools5A""Ins,
then select Con"itional Sum &i6ar" until it has a tic% in the box to the left, then clic% E C%ITI
=etKs say we have a list of dates from 7#
8/17/2019 Excel Formula Tips and Tricks
8/103
1ow clic% inside your list range and to go Tools5Con"itional Sum &i6ar". 7 :i@ard is a mini
program that steps you through a process and you should be loo%ing at Step " of the :i@ard,
which as%s the 'uestion>
Where is the list that contains the values to sum, including the column labels?
4ecause you were already clic%ed inside your list when you activated the /onditional Sum
:i@ard, and because your headings are defined as different to your list, Excel, will automatically
pic% up your list range of 7"ext button.
This brings you to Step # of the :i@ard which as%s you<
Which column contains the value to sum? Select the column label.
:e need to select Points from the drop down list as this is the column in which we are loo%ing
for our values to sum.
1ext we are as%ed to select a column that we wish to evaluate, and then type or select a value to
8/17/2019 Excel Formula Tips and Tricks
9/103
compare with data in that column.
Ma%e the following selections>
Under column L Select Team
Under *s< + Select =
Under This alue + Select 9lack Cros
1ow select A"" Con"ition. This will add the condition to the /onditional Sum dialog
/lic% the >ext button to ta%e you to Step ( of the :i@ard.
*n Step ( we are as%ed in which form we would li%e the formula copied to our wor%sheet. There
are two choices>
Copy just the formula to a single cell
Copy the formula and conditional values
:e will accept the default, copying the formula to a single cell.
/lic% the >ext button to ta%e you to the final step !Step A$ of the :i@ard where we are as%ed to
type or select a cell.
Select cell 5# and clic% Finish.
ou will notice when you clic% finish and can view the formula in cell 5# of your wor%sheet that
it has been pasted as an A##A? $ormula .
USI> T&< C%ITIS
ou can easily use more than one condition with the /onditional Sum :i@ard. =etKs see how
many points were scored overall between #F March and #N 7pril #))N.
/lic% inside your list and go to Tools5Con"itional Sum &i6ar". our list range will be
automatically pic%ed up. /lic% >ext to go to Step #.
Under Step #, select Points as the column to sum at the top of the dialog.
Ma%e the following changes for the columns you with to evaluate<
Under column L Select %ate
http://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/arrays.htm
8/17/2019 Excel Formula Tips and Tricks
10/103
Under *s< + Select 5=
Under This alue L t-pe +2 March +33@
1ow select 7dd /ondition. This will add the first condition to the /onditional Sum dialog
1ow to add the second condition<
Under column L Select %ate
Under *s< + Select =
Under This alue L t-pe +@ April +33@
7gain select A"" Con"ition. This will add the second condition to the /onditional Sum dialog.
/lic% the >ext button
This will ta%e you to Step ( of the :i@ard where we are as%ed in which form we would li%e theformula copied to our wor%sheet. This time we will select the second option> copy the formula
and conditional values. Select the >ext button.
*n Step A of the :i@ard you are as%ed to nominate a cell in which to paste your formula.
1ominate cell 5A and clic% Finish. This will paste the first date !#F?)(?)N$ to cell 5#. 1ow
select cell -# and again clic% Finish. This will paste the second date !#N?)A?)N$ to sell -#. 1ow
select *# and clic% Finish. This will paste the number of points scored between #F?)(?)N and
#N?)A?)N to *#
8/17/2019 Excel Formula Tips and Tricks
11/103
Sum &ith Multiple Criteria Examples of Excel formulas to sum a range of cells that meetmultiple criteria. ,BSUM, SUMP80BU/T and SUM with an * function?formula.
I* YOU #R, USIN 8;;< or a/oe4 US, SU9I*S
There are many times that it become necessary to SUM cells based on multiple criteria. The
examples below will show you ( ways that this can be done. -owever, often the most e$$icient
metho" is to use a i1ot Ta8le *f you are not familiar with Pivot Tables, I cannot stress enough
how much easier spreadsheet life becomes once you areH
*f you are not already aware, the Excel SUM* formula?function can only chec% to see if
specified cells meet one condition, e.g.
SUMIF S-ntax
=SUMIFrange0criteria0sumOrange!
=SUMI!A#A$%"&'$"%(#($)
:hich would SUM all numeric cells in the range 9B:9+3 where the corresponding row in
AB:AB3 was greater than #). *f we ommit the last optional argument !sumOrange$ the SUM*
would sum all cells in the range AB:AB3 which are greater than #), i.e.
=SUMI!A#A$%"&'$")
1ote the criteria argument is in the form of a number, expression, or text that defines which cellswill be summed. or example, criteria can be expressed as #), )&, &2#)&, &3#)&, &1orth&,
&1&.
0%, so if we need to sum a range of cells where corresponding cells !on the same row$ meet #, or
more conditions we can no longer use the SUM*. The formulas we can use, in order of their
efficiency, are
"$ BSUM Bownload advanced examples of BSUM
#$ SUMP80BU/T
($ SUM with and * function nested and entered as an array formula. See 7rray ormulas for
details
or all examples * will use the data as shown below. :here A+:E+2 has been named< %ataTa8le
http://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/sum-if.htmhttp://office.microsoft.com/en-us/excel-help/sumifs-function-HA010047504.aspxhttp://www.ozgrid.com/Excel/excel-pivot-tables.htmhttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.ziphttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/sum-if.htmhttp://office.microsoft.com/en-us/excel-help/sumifs-function-HA010047504.aspxhttp://www.ozgrid.com/Excel/excel-pivot-tables.htmhttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.ziphttp://www.ozgrid.com/Excel/arrays.htm
8/17/2019 Excel Formula Tips and Tricks
12/103
%SUM
7dds the numbers in a column of a list, or database, that match criteria you specify. or example>
=%SUM%ataTa8le09+0Criteria!
:ould Sum all cells in 9+:9+2 that meet the criteria is the named range< Criteria !shown below$
The top row of the range< /riteria has exact copies of the headings in the range BataTable . The
reference to cell 9+ is telling the BSUM to sum the numbers in 9+:9+2 that meet the criteria.
:e could replace the reference to 9+ with the text &Iuantity&, or the number # as the &Iuantity&
column is the second column in the table.
The criteria text &4ourbon& and &od%a&, under the criteria table heading &Bescription&, tells
BSUM that either &4ourbon& 08 &od%a& is a match. The same principle is used for the
&7lcohol /ontent&, i.e. &-igh& 08 &=ow&. This is then seen by BSUM as an 08 condition.
1ote the repeat of the date under &Use 4y Bate&. This is needed when using more than # rows as
8/17/2019 Excel Formula Tips and Tricks
13/103
the criteria as a blan% cell is seen as a wildcard character. *f we wanted to sum only data that lies
between # dates, we would need have # &Use 4y Bate& headings in our /riteria range and use<
3D+7pr+#))F below one of these headings and QD+Run+#))F under another. This is then seen by
BSUM as an 71B condition.
Bownload advanced examples of BSUM
SUM#
8/17/2019 Excel Formula Tips and Tricks
14/103
Surprising at it may seem, it is not as uncommon as you may thin% for an Excel user to want tosum every #nd, (rd, Ath etc cell in a spreadsheet. Excel has no standard unction that will dothis. -owever, it can be done it a number of different ways. 7ll these ways ma%e use of the#
%S!'(!#$!RW!)*)+:)*)--","%-,)*)+:)*)--,-""
7s this is an array formula it must 8e entered by pushing CtrlShi$tEnter and then Excel willadd the curly brac%ets so it loo%s li%e>
/%S!'(!#$!RW!)*)+:)*)--","%-,)*)+:)*)--,-""0
ou must let Excel add these. 7dding them yourself will cause the array formula not to wor%.
:hile this will do the ob, it is not goo" spreadsheet design to do so. The reason is, it is an
unnecessary use of an array formula and to ma%e matters worse, it has the olatile #
%SR$&C2!!#$!RW!)*)+:)*)--","%-"3!)*)+:)*)--""
http://www.ozgrid.com/Excel/Arrays.htmhttp://www.ozgrid.com/Excel/Arrays.htm
8/17/2019 Excel Formula Tips and Tricks
15/103
ou should however be aware that it will return DA/UE( if an- cells in the range contain text.This formula, while not a true array formula, will also slow down Excel if too many are usedand?or they reference a large range.
0%, enough of how we shouldn9t do this, lets loo% at a much better way that is not onl- more
e$$icient 8ut also $ar more $lexi8le. or this we will use the %SUM function. or the example *will use the range 7"
8/17/2019 Excel Formula Tips and Tricks
16/103
;o To Sum The Top um8ers
:hen you have a list of number in an Excel spreadsheet there are times when you may have toSum only the top x numbers in the list. *f the numbers are sorted then the tas% is a fairlystraightforward Sum function including on the top, or bottom x cells. 0ften however this is not
the case.
=ets say we have a list of number in the range 7"
8/17/2019 Excel Formula Tips and Tricks
17/103
(. :here you want the result, Enter
%$S!)*)+:)*)+--,+,)C)+:)C)"
:here CB=Criteria and C+%*+D4*R!)*)+:)*)+--,;"
8/17/2019 Excel Formula Tips and Tricks
18/103
#! %& " rue (en
)or *ac( rCell #n rRange
#! rCell.#nterior.Color#nde$ " lCol (en
vResult " Wor+s(eet)unction.%&,rCell-vResult
*nd #!
/e$t rCell
*lse
)or *ac( rCell #n rRange
#! rCell.#nterior.Color#nde$ " lCol (en
vResult " 0 1 vResult
*nd #!
/e$t rCell
*nd #!
Color)unction " vResult
End Function
ou can now use the custom function !/olorunction$ li%e>
=ColorFunctionCB0AB:AB+0T#UE! to SUM the values in range of cells 7"
8/17/2019 Excel Formula Tips and Tricks
19/103
Try also to avoid the use of *pplication.Folatile as it will not help in this case and only slowdown Excel9s calculation time.
Increase)%ecrease alues *f you have values on an Excel :or%sheet that you need to permanently increase, or decrease you can use aste Special. 1o Excel formulas neededH
Excel+ 3ncrease Excel "alues b# 1ercentage (9, Multi!l#, Add,
Subtract or 5i:ide
Current Special( /omplete Excel Excel Training /ourse for Excel CD + Excel #))(, only "AF.)).
FC.CF *nstant 4uy?Bownload, ,3 %a- Mone- 9ack uarantee G ree Excel -elp for =*EH
5ot any Excel IuestionsJ Free Excel ;elp
Increase)%ecrease Excel alues
*f you have values on an Excel :or%sheet that you need to permanently increase, or decrease
you can use aste Special.
Increase)%ecrease Excel alues 8- ercentage
=et9s say you have a list of values in 7"
=. ,nter the num/er =.=> into any /lan +ell an% then $opy it
8. No) sele+t the ran-e #=:#=;; an% -o to Edit@1aste S!ecial
6. $hoose "alues from un%er Paste an% then Multi!l# un%er Operation an%+li+ ;
8/17/2019 Excel Formula Tips and Tricks
20/103
*n Excel we can use the Su8totals feature found under %ata on the &orksheet Menu 9ar toSubtotal a table of data. :hen doing so it is imperati1e that the ta8le o$ "ata is sorte" 8- thecolumn -ou ish to Su8total !&at each change in&$. The Subtotal can be in the form of /0U1T,/0U1T 1UMS SUM, 7E875E, M*1, M7V, P80BU/T, STBBE, STBBEP, 78 or78P. =et9s use the table below to apply subtotals so we can get a count by &Bescription&.
7s you can see, the table has been sorted by the &Bescription& column. This is re'uired if wewish to use the &Bescription& column to get a Subtotal count. *t is important to note that /ount in
this case is not a count of only numbers li%e the CT &orksheet Function. or that, wewould use /ount 1ums.
The picture below now shows us what it loo%s li%e after applying Subtotals and also the settingswe have used.
=et9s now say we wanted to do a Su8total 8- Month using the &Use 4y Bate& dates . To achievethis we would need to add?use an extra column, which can hide if preferred, and have a formulathat changes num8er an" each change in month. The other thing we would need to do is sort
8/17/2019 Excel Formula Tips and Tricks
21/103
the table by the &Use 4y Bate& column. The formula we would use in an extra column, say &&would be as shown below>
2M01T-!/($
:e would copy this down to the last row that has a date in &Use 4y Bate&. *f F+ we could use theheading &Month&. This would then give us a column of numbers that only change hen themonth in the re$erence" Use 9- %ate column changes. :e would then simply applySubtotals as shown above using the &Months& column. 1ote that in this case, as the table has been sorted by &Use 4y Bate& we do not need to re+sort the table by &Month&. :e could, but theresult would be exactly the same.
9ol" Excel Su8totals -ere is how we can use /onditional ormatting in Excel to automatically bold the results of Subtotals.
0ne issue that is often encountered when wor%ing in Excel is that the Subtotal results, via%ata3Su8totals are not bolded or made easily distinguishable. This can ma%e the resulting datavery hard to read, especially if the table that we have applied Subtotals to contains manycolumns. This often means the resulting subtotals are over to the right, while their associatedheading are often in the first column.
/onsider the small example below where Subtotals have been added to a very small table ofdata.
9e$ore Su8totals
7 4
" Nuarter Cost
# Iuart" ").))
( Iuart" #).))
A Iuart" ").))
F Iuart# ").))
N Iuart# ").))
D Iuart( "F.))
C Iuart( ").))
")
Iuart( #F.))
A$ter Su8totals
http://www.ozgrid.com/Excel/excel-bold-subtotals.htmhttp://www.ozgrid.com/Excel/subtotal.htmhttp://www.ozgrid.com/Excel/excel-bold-subtotals.htmhttp://www.ozgrid.com/Excel/subtotal.htm
8/17/2019 Excel Formula Tips and Tricks
22/103
7 4
" Nuarter Cost
# Iuart" ").))
( Iuart" #).))
A Iuart" ").))
F Iuart" Total A).))
N Iuart# ").))
D Iuart# ").))
W Iuart# Total #).))
C Iuart( "F.))
")
Iuart( ").))
"" Iuart( #F.))
"#
Iuart# Total F).))
"(
5rand Total "").))
*n the above table our Subtotal headings ha1e 8een 8ol"e" by Excel, yet their associated resultsha1e not. 7s this table only has two columns, it is not that hard to read and pic%+out the Subtotalamounts. The more columns that a table has, the harder it becomes to visually pic%+out theSubtotals.
The Solution
The solution to this problem is to ma%e use of Excels Con"itional Formatting. Using the abovetable as an example try this before adding your Subtotals.
". Select 7"
8/17/2019 Excel Formula Tips and Tricks
23/103
the formula for each cell. or example, cell A+ will have a /onditional ormat formula of<28*5-T!7#,F$2&Total&, cell 9+ will also have 28*5-T!7#,F$2&Total& and cell 7( and 4(will have< 28*5-T!7(,F$2&Total&.
1ow add your Subtotals and your Subtotals will loo% li%e<
7 4
" Nuarter Cost
# Iuart" ").))
( Iuart" #).))
A Iuart" ").))
F Iuart" Total O3.33
N Iuart# ").))
D Iuart# ").))
W Iuart# Total +3.33
C Iuart( "F.))
")
Iuart( ").))
""
Iuart( #F.))
"#
Iuart# Total 23.33
"
( 5rand Total BB3.33
:hen you remove the Subtotals, the bolded font will no longer apply.
Taking It
8/17/2019 Excel Formula Tips and Tricks
24/103
F. /lic% 0%, then clic% A"" to add a second ormat /ondition
N. Select Formula is: and then add this formula< 28*5-T!7",F$2&Total&
D. 1ow clic% the Format button and then the Font tab and then select 9ol" Italic from
Font St-le: and then Single from Un"erline:
W. 1ow clic% 0;, then 0; again
our Subtotals will now loo% li%e below
7 4
" Nuarter Cost
# Iuart" ").))
( Iuart" #).))
A Iuart" ").))
F Iuart" Total O3.33
N Iuart# ").))
D Iuart# ").))
W Iuart# Total +3.33
C Iuart( "F.))
")
Iuart( ").))
"" Iuart( #F.))
"#
Iuart# Total 23.33
"(
5rand Total )++-.--
ou can of course use any format you li%e to ma%e your Subtotals easier to read.
Making the SU9T
8/17/2019 Excel Formula Tips and Tricks
25/103
2SU4T0T7=!",7"
". 7dd all the function names, in the same order as above, to a range of cells. * will use%B:%BB
#. :ith this range selected, clic% in the >ame 9ox !white box left of the Formula 9ar$ andtype the name< Su8s and then clic% Enter.
(. Select all of Column % and go to Format3Column3;i"e
A. 5o to ie3Tool8ars3Forms and then clic% on the Com8o 8ox /ontrol and clic% cell/#
F. Use the Si6e ;an"les to si@e the combo box so it can display the longest function name,i.e AE#AE
8/17/2019 Excel Formula Tips and Tricks
26/103
N. 8ight clic% on the /ombo box and choose Format control then the Control tab.
D. *n the Input range: type
8/17/2019 Excel Formula Tips and Tricks
27/103
". 0pen the attached wor%boo% on the 9ase Mo"el wor%sheet. The highlighted cellscontain formulas.
#. 1ow clic% on the :or%sheet tab named
8/17/2019 Excel Formula Tips and Tricks
28/103
(. *t is a good idea to document the area around your data table, so you and other users cantell what it is you are analysing.
A. ou can use %ata Ta8les to change up to two variables only
F. ou can create as many one+variable or two+variable %ata Ta8les as you li%e in a:or%boo%.
Bownload %ata Ta8le example wor%boo%
Sum 9eteen %ate #anges
SUMM3N4 NUM0ERS 0E7WEEN 5A7E RAN4ES. See also+ Count
bet%een date ranges
=et9s ta%e this a step further and sum up numbers in /olumn &4& that correspond to our daterange.
=SUM#
8/17/2019 Excel Formula Tips and Tricks
29/103
=counti$range0criteria!
=CTIFAB:A+305+3!
:hich would /0U1T all numeric cells in the range AB:A+3 where values were greater than #).
1ote the criteria argument is in the form of a number, expression, or text that defines which cells
will be counted. or example, criteria can be expressed as #), )&, &2#)&, &3#)&, &1orth&,
&1&.
=CTIFAB:A+30+3!0 =CTIFAB:A+305+3!0
=CTIFAB:A+30>orth!0 =CTIFAB:A+30>H!
0%, so if we need to count a range of cells where corresponding cells !on the same row but
different column$ meet ", or more conditions we can no longer use the /0U1T*. The other
formulas we can use, in order of their efficiency, are
"$ B/0U1T G B/0U1T7Bownload advanced examples of B/0U1T
#$ SUM as an array formula
($ /0U1T with and * function nested and entered as anarray formula .
-,U;/ will count only numeric cells where the cells% or corresponding cells meet a specified
criteria.
-,U;/A will count all cells !/e
8/17/2019 Excel Formula Tips and Tricks
30/103
%CT
/ount the numbers in a column of a list, or database, that match criteria you specify. or
example>=%CT%ataTa8le09+0Criteria!:ould /ount all cells in 9+:9+2 that meet the
criteria is the named range< Criteria !shown below$
The top row of the range< /riteria has exact copies of the headings in the range BataTable . The
reference to cell 9+ is telling the B/0U1T to count the numbers in 9+:9+2 that meet the
criteria. :e could replace the reference to 9+ with the text &Iuantity&, or the number # as the
&Iuantity& column is the second column in the table.
The criteria text &4ourbon& and &od%a&, under the criteria table heading &Bescription&, tellsB/0U1T that either &4ourbon& 08 &od%a& is a match. The same principle is used for the
&7lcohol /ontent&, i.e. &-igh& 08 &=ow&. This is then seen by B/0U1T as an 08 condition.
1ote the repeat of the date under &Use 4y Bate&. This is needed when using more than # rows as
the criteria as a blan% cell is seen as a wildcard character. *f we wanted to count only data that
lies between # dates, we would need have # &Use 4y Bate& headings in our /riteria range and
8/17/2019 Excel Formula Tips and Tricks
31/103
use< 3D+7pr+#))F below one of these headings and QD+Run+#))F under another. This is then seen
by B/0U1T as an 71B condition.
Bownload advanced examples of B/0U1T
%CTA
*f we changed the above B/0U1T example to<
=%CT%ataTa8le0A+0Criteria!
:e would always get a result of ) !@ero$ regardless of the criteria being met, or not. This is
because B/0U1T will only ever count all numeric cells and there are none in column A under
the &Bescription& field.
To get a count of these cells, we would need to use the B/0U1T7 function which would countall cells, text or numeric, where the criteria is being met. That is>
=%CTA%ataTa8le0A+0Criteria!
SUM as an arra- $ormula
1ormally, the SUM function will add all numeric cells in a specified range. -owever, when used
as an array formula with criteria used, it will give us a count instead of a sum. See below
example=SUM!!A'#A'1="2odka")3!'#'1&2A4U5!"67Apr7'$$1"))3!5'#5'1="8igh"))
9SUM!!A'#A'1="(ourbon")3!'#'1&2A4U5!"67Apr7'$$1"))3!5'#5'1="4ow"))
7s with the B/0U1T7 example, the above array entered !CtrlShi$tEnter$ SUM example
would count all rows where the &Use 4y Bate& is greater than D+7pr+#))F, the &Bescription& is
either &od%a& 08 &4ourbon& and the &7lcohol /ontent& is &-igh& 08 &=ow&.
The reason it gives a count is because each chec% is returned as T8UE !has a value of "$ or
7=SE !has a value of )$. So, in the above example, the third row chec% would actually loo%
li%e>=SUM!!$)3!$)3!))9SUM!!)3!)3!))7s you can see, unless all , criteria are met in at
least one o$ the Sum $unctions, the result will always be ) !7=SE$. To read about this in
detail, see our 7pril edition of our free Excel 1ewsletter
CT an" IF
2/0U1T!*!7#
8/17/2019 Excel Formula Tips and Tricks
32/103
The above, does the same as the array SUM example and must be entered by pushing
CtrlShi$tEnter. 1ote we have told the /0U1T to count all cells in 4#
8/17/2019 Excel Formula Tips and Tricks
33/103
E>%
8/17/2019 Excel Formula Tips and Tricks
34/103
S-ntax
2substitute!text,ol"Ptext,nePtext,instanceOnum$
&hat it "oes
Substitutes newOtext for oldOtext in a text string. Use SU4ST*TUTE when you want to replace
specific text in a text string> use 8EP=7/E when you want to replace any text that occurs in a
specific location in a text string.
Example
2SU4ST*TUTE!7", &Sales&, &/ost&$ *f AB had the text &Sales Bata& the formula result would be
&/ost Bata&.
/E>
S-ntax
2len!text$
&hat it "oes
=E1 returns the number of characters in a text string.
Example
2=E1!7"$ *f 7" had the text &Sales Bata& the formula result would be ") as AB has G text
characters and B space character.
Count &or"s in a Cell
The formula below will return the number of words !not characters$ in cell AB
2=E1!7"$+=E1!SU4ST*TUTE!7",& &,&&$$"
9e aare that super$luous spaces are also counte" and may give misleading results. To ensure
accuracy we can simply nest the T#IM formula function?formula in the first /E>
2=E1!T8*M!7"$$+=E1!SU4ST*TUTE!7",& &,&&$$"
Count &or"s in a #ange o$ Cells
The formula below will return the number of words !not characters$ in cells AB:A2
2=E1!T8*M!7"G7#G7(G7AG7F$$+=E1!SU4ST*TUTE!7"G7#G7(G7AG7F,& &,&&$$F
8/17/2019 Excel Formula Tips and Tricks
35/103
2=E1!T8*M!7"G7#G7(G7AG7F$$+=E1!SU4ST*TUTE!7"G7#G7(G7AG7F,& &,&&$$
8ows!7"
8/17/2019 Excel Formula Tips and Tricks
36/103
1ow, Starting from FB !or the cell you chose$, you have a list containing only one occurrence ofeach item in the list.
Enter the CTIF Formula
1ow we have the uni'ue list, we can now count how many times each item appears in ouroriginal list in AB:AB33. So in F+ !" is a heading and can read &/ount&$ enter the CTIF ormula as shown below
2/0U1T*!7#,*?()A)8+)A)*=5A7E(*8,@,8
Syntax for the date function is: DATE(Year, Month, Day)
/
8/17/2019 Excel Formula Tips and Tricks
37/103
*t is used in the following manner<
=/
8/17/2019 Excel Formula Tips and Tricks
38/103
The metho" o$ sorting is 8est as a =00;UP that searches in a sorted range is MU/- faster.The effect of this can be significant if the table is large and?or you have many =00;UPfunctions.
;o to stop the D>)A( error * Excel i"eo Tutorials
Stop D>)A( In lookup
Sto! 7e N/AB Error in ";;
2=00;UP!&Bog&,7"
8/17/2019 Excel Formula Tips and Tricks
39/103
Excel Dloou! formula$function ex!lained
The Excel -loo%up formula is perhaps one of the most used formula used when loo%ing up data
set up in a table.
Want to learn the ,F+el Hlooup formula an% other ,F+el *ormulas?
The ,F+el Hlooup *ormula ,Fplaine%
Perhaps one of Excels most commonly needed unctions is the -loo%up.
The Excel -loo%up function is used to loo% for specified data in the first row of a table of data.
0nce found it will return a result, from the same column, a specified number of rows down from
the first row. The syntax for -loo%up is<
%BlooGup! looGupHvalue %tableHarray %ro5HindexHnum %rangelookup)
*t is used in the following manner<
=;lookup%og0AB:EB3330,0False!
1ote the use of False as the optional rangelookup 7rgument. This tells the -loo%up to find an
exact match and is most often needed when loo%ing for a text match. *f this is omitted, or True,
you will may get unwanted results when searching for text that is in an unsorte" row of data.
This means that when True is used, or the rangelookup 7rgument is omitted, your data should
be sorted !by the $irst row$ in ascending order.
The use of True, or rangelookup 7rgument is omitted, is most often used when loo%ing at
numeric data that resides in the first row of your table of data.
;/"ill >
G=8>.
6 Joe 88
GG8>.
9ary >
8/17/2019 Excel Formula Tips and Tricks
40/103
HG>KL.
;;Dae 8=
IGKL.
68*ran KL
>G>;;.
8>Sue =
@G6L.
>Hillary =>
?G;=.
>Eate 8>
8
G.>
#leisha 66
*f we were to use<
=;/
8/17/2019 Excel Formula Tips and Tricks
41/103
will only loo% in the left most column and return the result from the corresponding cell to theright. There are times when users need to loo%up data in any column of table and return thecorresponding cell to the left.
Excel is very rich in =oo%up formulas, with perhaps the =00;UP being the most popular.
-owever, the draw+bac% with all Excel9s =oo%up formulas is that they will only loo% in the le$tmost column and return the result from the corresponding cell to the right. There are timeswhen users need to loo%up data in an- column o$ a ta8le and return the corresponding cell to thele$t. To do so, we can use the I>%E R MATC; ormula?unctions
I>%E R MATC;
The I>%E ormula?unction has # versions available. :e will only be using the $irst 1ersionhere>
"$ I>%E ormula?unction. 8eturns the value of a specified cell or array of cells within array.
S-ntax
I>%E!arra-0roPnum,columnnum$
#$ I>%E ormula?unction. 8eturns a reference to specified cells within reference.
S-ntax
I>%E!re$erence0roPnum,columnnum%areanum$
The M7T/- ormula?unction 8eturns the relative position of an item in an array that matchesa specified value in a specified order. Use M7T/- instead of one of the =00;UP functions
when you need the position of an item in a range instead of the item itself.
S-ntax
MATC;!lookupP1alue,lookupParra-,matchOtype$
See Excels help for full details on these # ormula?unctions.
/e$t /ookup
To do a left loo%up we can use the I>%E unction?ormula with the MATC;
unction?ormula nested in the #oPnum 7rgument of the *1BEV unction?ormula. =et9s sayour table of data resides in a table named %ataTa8le and this named range refers to< AB:%G See *mage below>
http://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htm
8/17/2019 Excel Formula Tips and Tricks
42/103
7s you can see, the first example uses the formula<2*1BEV!BataTable,M7T/-!&8;PA&,*B,)$,"$ and ma%es use o$ the >ame" ranges. Thesecond does exactly the same, but does not use the >ame" ranges, i.e.2*1BEV!7"um8er an" #o >um8er:e can either ta%e this a step further andensure the columnPnum argument supplied is always correct by nesting another MATC; ormula?unction into the columnPnum argument. The formula for this would be>
2*1BEV!BataTable,M7T/-!&8;PA&,*B,)$,M7T/-!&1ame&,-eadings,)$$
08, with no 1amed 8anges
2*1BEV!7"
8/17/2019 Excel Formula Tips and Tricks
43/103
and double clic% the ill -andle so this formula is copied down to 4#).
7s you can see, this returns a text result of the numeric scope our numbers fall into.
-ere9s the details of how this wor%s. Text 'uoted from Excel help
S>;/A?#=4,,@U*!lookupvalue%lookupvector%resultvector)
looGupHvalue: +euired. A value that 4,,@U* searches for in the first vector. 4ookupvalue
can be a number% te
8/17/2019 Excel Formula Tips and Tricks
44/103
*n this example * have used the range 7#%E)MATC; Functions :hile the loo%up unction is very useful, it cannot loo% in an- /olumn, onl- the Bst. 7lso, it cannot offset x columns to the left or return the value x rows before or after the found value. 7n *1BEV G M7T/- combo will allow for all of thisflexibility.
:hile the loo%up unction is very useful, it cannot loo% in an- /olumn, onl- the Bst. 7lso, it
cannot offset x columns to the left or return the value x rows before or after the found value. 7n
*1BEV G M7T/- combo will allow for all of this flexibility.
SYNT#'
I>%E!arra-,rowOnum,columnOnum$
MATC;lookupP1alue0 lookupParra-, YmatchOtypeZ$
http://www.ozgrid.com/Excel/named-ranges.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/formula-errors.htmhttp://www.ozgrid.com/Excel/formula-errors.htmhttp://www.ozgrid.com/Excel/dynamic-formulas.ziphttp://www.ozgrid.com/Excel/index-match.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/named-ranges.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/formula-errors.htmhttp://www.ozgrid.com/Excel/dynamic-formulas.ziphttp://www.ozgrid.com/Excel/index-match.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htm
8/17/2019 Excel Formula Tips and Tricks
45/103
/onsider the above table and that we need to find out the &Proect& corresponding to the
&0riginal Proect Start Bate& of the A?)W?#))C. :e would use>
2*1BEV!7"
8/17/2019 Excel Formula Tips and Tricks
46/103
Fin" the >th
2=00;UP!&4ill (&,7"
8/17/2019 Excel Formula Tips and Tricks
47/103
The custom function?formula below was written in Excel #))( and may not wor% in earlier Excel
versions.
Function Nth_Occurrence(range_loo As Range, !ind_it As String, _
occurrence As "ong, o!!set_ro# As "ong, o!!set_col As "ong)
Dim lCount As Long
Dim r)ound As Range
et r)ound " range2loo+.Cells,0- 0
)or lCount " 0 o occurrence
et r)ound " range2loo+.)ind,!ind2it- r)ound- $l3alues- $lW(ole
/e$t lCount
/t(2Occurrence " r)ound.o!!set,o!!set2row- o!!set2col
End Function
The custom $unction)$ormula can no 8e use" like shon 8elo
=;th,ccurrence!F(F#F(F''%"8arry"%0%$%)
The s-ntax is
=;th,ccurrence! rangeHlooG % findHit %occurrence %offsetHro5 %offsetHcol )
:here 9B:9++ !rangeOloo%$ is the range to find the ,r" occurrence !occurrence$ of
&;arr-& !findOit$. :hen found, it will return the value by offsetting 3 ros !offsetOrow$ and B
column !offsetOcol$ to the right. The offsetOrow and offsetOcol arguments can 8e negati1e
1alues i$ that is hat is nee"e".
Excel /ookup Ta8le /ookup is the perfect Excel formula for numerical values contained in arange. -owever if you tried to use =oo%up with text in a table, it9s use would be limited, or
example surnames such as Smith, Smithson, Smithy, Smithson+Racobs would create problems.
/ookup is perfect for numerical values contained in a range. -owever if you tried to use=oo%up with text in a table, it9s use would be limited, or example surnames such as Smith,Smithson, Smithy, Smithson+Racobs would create problems. *f you entered a surnameincorrectly, =oo%up will step bac% to the closest possible match.
http://www.ozgrid.com/Excel/lookup-table.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/lookup-table.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htm
8/17/2019 Excel Formula Tips and Tricks
48/103
*f you wish to glean information from a table that uses text, you can use =oo%ups optionalfourth argument called match+type. This argument forces =oo%up to return 1?7 if an exactmatch cannot be found in the first column of your table. This type of =oo%up is perfect to gleaninformation from an address list.
=et9s say we wanted to find out the phone number of Smithson+Racob. :e would use2=00;UP!4"F,7#)A in lookup$ormulas.
*f we wanted to find the Bate of 4irth from within the Table we could use2=00;UP!4"F,7#
8/17/2019 Excel Formula Tips and Tricks
49/103
0%, let9s go with a sample using a small table of data for ease of understanding. ou can
"onloa" a orking sample $rom the here
The layout of our data are headings in row " from 7"AME% %?>AMIC #A>ES 0r here for all types of 1amed 8anges .
>AMI> T;E >EE%E% #A>ES
ou can, if you wish, use many more rows than 7"ame5%e$ine.
#$ *n the &1ames in :or%boo%
8/17/2019 Excel Formula Tips and Tricks
50/103
N$ 1ow after clic%ing A"" for the last named range, clic%
8/17/2019 Excel Formula Tips and Tricks
51/103
not allowed, Excel oul" replace an- spaces ith the un"erscore. That is &Rune ;& would be
named &RuneO;&.
1ow we can simply Enter the *ntersection formula as shown below into any cell and it will
return the Bepartment !or any other column$ of the persons name we use. *n this case it9s &Rune
;&. It is 1ital to note that there IS a space 8eteen WuneP an" %epartment
%LuneH= $epartment
/ookup R #eturn Correspon"ing #esult :hile we can use any of the lin%s above for loo%upformulas, all re'uire a table of cells in a :or%sheet. *f you only have small number of items toreturn based on the value of another cell, we can do the loo%up without leaving the cellH
/ookup &ith Cell
:hile we can use any of the lin%s above for loo%up formulas, all re'uire a table of cells in a:or%sheet. *f you only have small number of items to return based on the value of another cell,we can do the loo%up without leaving the cellH
Choose R Match
The formulas we can use to perform the loo%up within the cell is the /-00SE function, nestedwith the M7T/- function. See Excel help if unfamiliar we these functions. 0%, let9s assume youhave a changing value in 7" and depending on that value we wish to return a result to 4". or
example, %eeping it simple, we have a alidation =ist that a user can choose from any one ofthese /at, Bog, Mouse, -orse or 8abbit. 4ased on their choice we wish to show a different resultin 4". *n 4" Enter this formula>
=C;ame" Constants . -owever,when done, we can no longer use the /-00SE unction. :e use the *1BEV unction instead.
"$ 5o Insert5>ame5%e$ine and type 1et in >ames in ork8ook
http://www.ozgrid.com/Excel/cell-lookup.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/named-ranges.htmhttp://www.ozgrid.com/Excel/named-constants.htmhttp://www.ozgrid.com/Excel/cell-lookup.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/named-ranges.htmhttp://www.ozgrid.com/Excel/named-constants.htm
8/17/2019 Excel Formula Tips and Tricks
52/103
#$ *n #e$ers to: type =G"at"%"-og"%"Mouse"%"8orse"%"+abbit"H and clic% A""
($ Type 1et(ood in >ames in ork8ook
A$ *n #e$ers to: type =G"at ood"%"-og ood"%"Mouse ood"%"8orse ood"%"+abbit ood"H
and clic% A"" then Cancel.
1ow, in the cell use
=I>%EetFoo"0MATC;AB0et03!!
:hen?if we need to edit the named constants 1et(ood or 1et , we can do so in one location andour result will flow through the entire :or%boo%.
/ookup Scale
*n the above examples we have used text values. -owever, it is often needed that we need toloo%up numbers that match a scale. That is, all results between ) and CC.CC should return oneresult, while those between ")) and "CC.CC another and so on... =et9s say we need to match thesales amount by person to %now what percentage their commission is.
"$ 5o Insert5>ame5%e$ine and type Commission in >ames in ork8ook
#$ *n 8 e$ers to: type =G$%$.%$.'%$.0%$.%$.1%$.J%$.6%$.K%$.L%H and clic% A""
($ Type Sales in >ames in ork8ook
A$ *n #e$ers to: type =G$%$$%'$$%0$$%$$%1$$%J$$%6$$%K$$%L$$%$$$H and clic% A"" thenCancel.
1ow, in the cell use
=I>%ECommission0MATC;AB0Sales0B!!
This will return a between ) and ")), based on the value in 7".
Sales
L
Commissio
n)+CC.CC )
"))+"CC.CC
")
#))+#CC.CC
#)
http://www.ozgrid.com/Excel/percentages.htmhttp://www.ozgrid.com/Excel/percentages.htm
8/17/2019 Excel Formula Tips and Tricks
53/103
())+(CC.CC
()
A))+ACC.CC
A)
F))+FCC.CC F)
N))+NCC.CC
N)
D))+DCC.CC
D)
W))+WCC.CC
W)
C))CCC.CC
C)
"))) "))
*t is important to note that both array constants !in the #e$ers to$ are in 7scending order and wehave use B for the optional Matchtype argument for the M7T/- unction. ou can useBescending order, in which case Matchtype must be 7B
Excel ;-perlinks -ow to get the most from hyperlin%s. -yperlin%s that still wor% when a:or%sheet name changes. /reate a hyperlin% to a /hart Sheet
-yperlin%s provide us with a convenient way to ump to a specific cell, wor%sheet, wor%boo%,
another program on your hard drive, a networ%, an intranet or the internet. :e can give our
hyperlin%s meaningful names, and provide a screen tip available when the mouse is hovered over
them.
T< C#EATE A ;?E#/I> T< A> EISTI> FI/E
8/17/2019 Excel Formula Tips and Tricks
54/103
lin% to.
9rose" ages
*f you want to select a web page, use this option to select from a list of web pages you have
browsed.
#ecent Files
*f you want to lin% to a recently used file, use this option.
A""ress
ou can paste the address of the file you wish to lin% to in this area.
inally, you can type the text you wish to display in the Text to %ispla- option, and if you wish
you can add a screen tip that can be seen when the mouse is hovered over the hyperlin%.
C#EATE A ;?E#/I> T< A SECIFIC /ACE A &E9 AE
To hyperlin% to a specific point in a webpage, you must first boo%mar% the location you wish to
hyperlin% to.
ou can then ma%e a selection from /urrent older, 4rowsed Pages, 8ecent iles, type in the
address in the 7ddress< area or select the web page by opening your browser and searching forthe web page you want to lin% to. 0nce found, switch bac% to Excel without closing down your
browser.
/lic% 9ookmark , then double clic% the boo%mar% you want to use.
T< C#EATE A ;?E#/I> T< A /ACE I> A &
8/17/2019 Excel Formula Tips and Tricks
55/103
lace in this %ocument: Use this option to lin% to a location in the current wor%boo%.
Existing File or &e8 age: To lin% to a location in another wor%boo%, choose Existing ile or
:eb Page. 0nce you have located the wor%boo% you with to lin% to, select the 4oo%mar% button
and in the list under /ell 8eference, select the sheet you wish to lin% to, and in the Type in the
cell reference box, enter in the cell reference number. /lic% 0;. *f you have given your cells a
defined name, then in the list under Befined 1ames, clic% the name of the range you wish to lin%
to and clic% 0;.
'f you use this option, it is better to use a defined name to linG to another WorGsheet. 'f you do
this and your 5orGsheet name changes, your hyperlinGs 5ill be unaffected.
C#EATE A ;?E#/I> T< A >E& FI/E
To create a hyperlin% to a new file, you must first right clic% on your text or graphic to be used torepresent the hyperlin%.
Select Create >e %ocument $rom the /ink to: area of the dialog.
Under 1ame of new document< enter in the name of your document. The full path should be
shown under the heading ull path< *f this is not the path you want, clic% the /hange button and
select the location, then clic% 0;.
There are two options under the :hen to Edit< box, ma%e the choice to either !a$ Edit the 1ew
Bocument =ater or !b$ Edit the 1ew Bocument 1ow.
;?E#/I> T< A> EMAI/ A%%#ESS
inally, if you wish to hyperlin% to a specific email address, again right clic% on your text or
graphic to represent your hyperlin%. Then select Email address under the =in% to< area of the
dialog. *n the email address and Subect box, type in the recipient and the subect of your email.
3 Jote that some bro5sers and email accounts 5ill not recogniNe a Subject line.
;?E#/I> T< A C;A#T S;EET
Unfortunately there is no standard way to lin% to a /hart Sheets. *n fact, Excel ill not let -ou
"o this. The wor%around to this is 'uite simple though.
"$ 7dd a ne :or%sheet.
http://www.ozgrid.com/Excel/named-ranges.htmhttp://www.ozgrid.com/Excel/named-ranges.htm
8/17/2019 Excel Formula Tips and Tricks
56/103
#$ 0n the :or%sheet you would li%e the hyperlin% to the /hart sheet on, add a hyperlin% to the
new :or%sheet. -owever, the text to "ispla- should read something li%e< Spen"ing Chart or
any applicable text.
($ 7ctivate the newly added :or%sheet and go to Format5Sheet5;i"e
A$ 8ight clic% on the hyperlin% :or%sheet name tab and choose ie Co"e. *n here paste the
code below and change Spen"ing Chart to suite your specific text.
$ri%ate Su& 'orsheet_Follo#perlin(B*al +arget As perlin)
#! arget.e$toDisplay " 4pending C(art4 (en (eets,4pendingC(art4.elect
End Su&
;-perlink to /ookup #esult Excel is 'uite rich in =oo%up type formulas, some of the more popular ones are =00;UP , *1BEV?M7T/- and -=00;UP . These all do a great ob inloo%ing up a value we specify and then return a corresponding result. -owever, it9s often the casethat we need to go to the row containing the found value, or its offset return.
Excel is 'uite rich in =oo%up type formulas, some of the more popular ones are =00;UP ,
*1BEV?M7T/- and -=00;UP . These all do a great ob in loo%ing up a value we specify andthen return a corresponding result. -owever, it9s often the case that we need to go to the rowcontaining the found value, or its offset return.
;-perlink To Foun" #esult
:hat we can do to actually go to our found result is nest the /E== function with some Textunction nested inside the -yperlin% unction .
=ets use an example table as shown below. The upper left cell is 7" and only the "st ") rows and( columns are shown to %eep it simple.
>ames Age Cit-
Bave #" 1ew or%
4ill (( :ashington
ran% FA Ballas
Mary "C San rancisco
http://www.ozgrid.com/Excel/hyperlink-lookup.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/left-lookup.htmhttp://www.ozgrid.com/Excel/left-lookup.htmhttp://www.ozgrid.com/Excel/excel-hlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/left-lookup.htmhttp://www.ozgrid.com/Excel/excel-hlookup-formula.htmhttp://www.ozgrid.com/VBA/return-sheet-name.htmhttp://www.ozgrid.com/Excel/hyperlinks.htmhttp://www.ozgrid.com/Excel/hyperlink-lookup.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/left-lookup.htmhttp://www.ozgrid.com/Excel/excel-hlookup-formula.htmhttp://www.ozgrid.com/Excel/excel-vlookup-formula.htmhttp://www.ozgrid.com/Excel/left-lookup.htmhttp://www.ozgrid.com/Excel/excel-hlookup-formula.htmhttp://www.ozgrid.com/VBA/return-sheet-name.htmhttp://www.ozgrid.com/Excel/hyperlinks.htm
8/17/2019 Excel Formula Tips and Tricks
57/103
Rohn F) Utah
-arry FA ;ansas
Rune () 0hio
;ate N) /alifornia
7leisha FF Montana
:hat we are doing is loo%ing up a name from /olumn 7 and returning any correspondingcolumn from the found row in /olumn 7. 4efore we get to the loo%up part though we need toreturn the :or%boo% and :or%sheet name in the format needed for the -yperlin% function. orexample X9ookB.xlsYSheetB(
7s mentioned above, we use the /E== unction with some Text unctions to parse out only the bits we need. 7s the /E== unction is a olatile unction it pays to create onl- B instance of theneeded ormula and re+use as many times as needed. 7 1amed ormula is ideal for this.
". 7ctivate the :or%sheet the data table resides on.
#. 5o to Insert5>ame5%e$ine or Formulas5>ame Manager + >e in #))D.
(. Use the name WbSheet and have it refer to< =MI%CE//$ilename0AB!0FI>%X0CE//$ilename0AB!!0+2@!R(
A. &8Sheet R A%%#ESSMATC;B0AB:A+33303!0B!0B R s'
In$o!
1ote the underlined B this what determines the relative /olumn in our table to which we gowhen clic%ing the -yperlin%. This can of course also be variable by simply entering the numberin another cell, that is
=;?E#/I>&8Sheet R A%%#ESSMATC;B0AB:A+33303!0+!0B R
s' In$o!
http://www.ozgrid.com/Excel/named-formulas.htmhttp://www.ozgrid.com/Excel/named-formulas.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/named-formulas.htmhttp://www.ozgrid.com/Excel/data-validation.htm
8/17/2019 Excel Formula Tips and Tricks
58/103
0r, if the column order may change, we can again !optional$ use a alidation list to specify the/olumn heading and then use the M7T/- function to return its relative position. *n the case below * have again used + to return the column heading needed.
=;?E#/I>&8Sheet R
A%%#ESSMATC;B0AB:A+33303!0MATC;+0AB:WB03!!0B R s'In$o!
%-namic #eports -ere you can see how we can the Batabase functions to produce dynamicreporting from a table of data.
PivotTables are an excellent tool to use in Excel when you need a report, or statistics based on a
table of data. -owever, for most users there are over+whelming and give too much detail.
#lternatie Report
The %ata8ase Functions is Excel combined with Bata alidation and some outside the box
thin%ing, is another easy way to get reports on your table data. :e use Bata alidation to refer to
a 1amed 8ange list of
8/17/2019 Excel Formula Tips and Tricks
59/103
where this range represents your table headings. 1ow starting in 7F Enter SUM0 >um8er
CT0 All Count0 ro"uct0 Min0 Max0 A1erage across to 5F.
1ow the formulae going across, starting in EN, directly underneath their headings Enter>
". 2BSUM!Table,ield,*1B*8E/T!/riteria/ell$$
#. 2B/0U1T!Table,ield,*1B*8E/T!/riteria/ell$$
(. 2B/0U1T7!Table,ield,*1B*8E/T!/riteria/ell$$
A. 2BP80BU/T!Table,ield,*1B*8E/T!/riteria/ell$$
F. 2BM*1!Table,ield,*1B*8E/T!/riteria/ell$$
N. 2BM7V!Table,ield,*1B*8E/T!/riteria/ell$$
D. 2B7E875E!Table,ield,*1B*8E/T!/riteria/ell$$
Select /( !under the heading +n" %E>T /ISTS &IT; /
8/17/2019 Excel Formula Tips and Tricks
60/103
The principle we are going to use is the same as we used to lin% the # validation lists in the basic
download example. That is, we use the *ndirect unction which will allow Excel to see the
content of any cell as either a range address, or, as in our case, a named range.
0ur end loo%up unction, based on the download example above, will be this>
%F4=&1!)K),'J$'RC2!S&KS2'2&2!)*)A,@ @,@H@"",)C),(*4S"
4# !/ookupP1alue$ is the value we are going to be loo%ing for.
*1B*8E/T!SU4ST*TUTE!7#G#,& &,&O&$$ !Ta8leParra-$ is the named table we are going to
loo% for 4# in and in the left most column of that table. 1ote the use of the SU4ST*TUTE
unction which substitutes any spaces with the underscore. This is because named ranges can
never have spaces in their names. 7lso note the use of 7#G# and not simply 7#H This is
because we have already named the lists we use in the Bata alidation list the same as whatever
is chosen from 7#. So, when we name our tables, we use the same name as their lists, but add a #
on the end. or example, our table for /ities has been named &/ities#&.
/# !ColPin"exPnum! contains a Bata alidation list with the numbers # and ( !only (
columns in example$. 0ur loo%up will offset !right$ that many columns from the left most
column in the named table it loo%s in.
7=SE ! +angelookup$ tells loo%up we want an exact match !not case sensitive$.
DST)A(
7s you change items in the Bata alidation lists you will get 1?7H until a existing item or the
correct named table is chosen. This can be rectified in a number of way, some less efficient that
others though. See Stop 1?7H in =oo%ups
>este" IF Formula /imitation 0ne limitation of Excel is that we can only nest Excel formulasup to D levels. This is particularly limiting when trying to add nested * unctions?ormulas thatre'uire greater than D conditions.
0ne limitation of Excel is that we can only nest formulas up to D levels. This is particularlylimiting when trying to add nested * unctions?ormulas that re'uire greater than D conditions.See Also: >ame" Formula method here
*f you hit the D level limit, odds are that you are not using the correct method for your tas%. orexample, one common use of multiple nested * unctions?ormulas is when we wish to have avalue returned based on the content of another cell. *f this is your problem, then it9s very li%ely
http://www.ozgrid.com/FreeDownloads/MatchingLists.ziphttp://www.ozgrid.com/FreeDownloads/MatchingLists.ziphttp://www.ozgrid.com/Excel/stop-na-vlookup.htmhttp://www.ozgrid.com/Excel/seven-nested.htmhttp://www.ozgrid.com/Excel/nested-function-limit.htmhttp://www.ozgrid.com/Excel/nested-function-limit.htmhttp://www.ozgrid.com/FreeDownloads/MatchingLists.ziphttp://www.ozgrid.com/FreeDownloads/MatchingLists.ziphttp://www.ozgrid.com/Excel/stop-na-vlookup.htmhttp://www.ozgrid.com/Excel/seven-nested.htmhttp://www.ozgrid.com/Excel/nested-function-limit.htm
8/17/2019 Excel Formula Tips and Tricks
61/103
the use of the lookup $ormula with a loo%up table will solve your problemsH See screen shot below>
*f you are evaluating numbers being entered into a cell you could use the /-00SEunction?ormula. or example, if a user can enter a number between " and ") into 7", you maywish to have the text returned based on the number they enter. See example below
=C;
8/17/2019 Excel Formula Tips and Tricks
62/103
I* #= C 8= to 6; then 6;TaFI* #= C 6= to K; then K;TaFI* #= C K= to >; then >;TaFI* #= C >= to ; then ;TaFI* #= C = to um8ers Methods and Excel ormulas for rounding numbers in Excel
Excel #oun"ing
Excel allows us to easily round number for viewing via Format3Cells + >um8er + and then>um8er under Category. ou can short cut this by using the Increase %ecimals and %ecrease%ecimals on the ormat toolbar, to the right of L 0 symbols. -owever, as with all formatting,the true underlying value of the cell is not changed. This matters when you add some numbersand you get a lower result than you expect. or example, Enter ".N and ".N in # cells, say 7" and7#. 1ow format these so no decimal places are showing and you get # and #. 1ow add thesetogether li%e =AB4A+ and you get a result of (, not A. ou can change this and have excel wor%
http://www.ozgrid.com/Excel/named-formulas.htmhttp://www.ozgrid.com/Excel/named-constants.htmhttp://www.ozgrid.com/Excel/excel-fill-handle.htmhttp://www.ozgrid.com/Excel/excel-rounding.htmhttp://www.ozgrid.com/Excel/named-formulas.htmhttp://www.ozgrid.com/Excel/named-constants.htmhttp://www.ozgrid.com/Excel/excel-fill-handle.htmhttp://www.ozgrid.com/Excel/excel-rounding.htm
8/17/2019 Excel Formula Tips and Tricks
63/103
with all numbers as they are displayed via Tools3E%, that this is a one+way method and the changes to 7== your numberscannot be undone.
2'1. ou can can automatically permanentl- change A// numbers in a :or%boo% to their
displayed value by chec%ing recision as "ispla-e" and then clic%ing um8ers %on
The 80U1BB0:1 function will round numbers down, toward @ero.
=#%%B.@03! will result in a value of "
I>T !although less flexible$ can also be used. =I>TB.@! will also result in "
#oun" to a Chosen Multiple
There is another round function in Excel that will round a number to the multiple we specify.
This function is called M#%. *t is not available by default, so you need to go toTools3A""7ins and chec% Anal-sis Toolpak .
=M#%++.20B3! will result in a value of #)
=M#%++.202! will result in a value of #F
Some
8/17/2019 Excel Formula Tips and Tricks
64/103
Some of the other function that can used for rounding are>
". /E*=*15
#. =008
(. 0BB
A. EE1
F. T8U1/
N. B0==78
D. *1T
ercentages in Excel 7 percent is a ratio of a number to ")) and is usually expressed using the percent !$ symbol. *n Excel, a number can be expressed in a few different ways and used tocalculate a percentage in Excel.
7 percent is a ratio of a number to ")) and is usually expressed using the percent !$ symbol. *nExcel, a number can be expressed in a few different ways and used to calculate a percentage inExcel.
or example, F) stands for the ratio F)
8/17/2019 Excel Formula Tips and Tricks
65/103
A1erage Exclu"ing eros Excel has a built in formula?function that ma%es averaging a range ofcells easy. -owever, the Excel formula 7E875E does not exclude @eros.
Excel has a built in formula?function that ma%es averaging a range of cells easy. *f we assume
your numbers are in 7"
=SUMAB:AB33!)CTIFAB:AB33053!
This method ill not ork shoul" -ou ha1e negati1e num8ers unless you change 53 to
53 The drawbac% is it will then count blan% cells. :here as the one below wont.
=SUMAB:AB33! ) CTAB:AB33! 7 CTIFAB:AB3303!!
=SUMIFAB:AB33053!)CTIFAB:AB33053! :ill also exclu"e negati1es unless you
use 53. -owever, it will then count 8lank cells.
*f you do have negative numbers, and no blan% cells, use>
=SUMAB:AB33!)CTIFAB:AB33053!
%AE#AE
The other method is via the B7E875E function. This function is part of the %ata8ase
$unctions and all are extremely useful when?if you need specify multiple criteria. The
http://www.ozgrid.com/Excel/average-without-zero.htmhttp://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.ziphttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.ziphttp://www.ozgrid.com/Excel/average-without-zero.htmhttp://www.ozgrid.com/Excel/Sum.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.ziphttp://www.ozgrid.com/FreeDownloads/DFunctionsWithValidation.zip
8/17/2019 Excel Formula Tips and Tricks
66/103
B7E875E , in the case of numbers being in 7#
=%AE#AEAB:AB330B09B:9+!
:here &"& represents the relative column position to average in the range 7"
=MI>AB:AB33!
There is however, one draw+bac% with this. That is, it includes cells that contain ) !@eros$. This
can give you unexpected results. So how do we omit @eros from our averageJ
SMA// Function)Formula
4y far the most efficient method is to use the SM7== and CTIF $ormula as shown below>
http://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/minimum-without-zero.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/Excel/arrays.htmhttp://www.ozgrid.com/Excel/minimum-without-zero.htmhttp://www.ozgrid.com/Excel/count-if.htm
8/17/2019 Excel Formula Tips and Tricks
67/103
SM7== 8eturns the %+th smallest value in a data set.
=SMA//AB:AB330CTIFAB:AB3303!4B!
:here the countif is counting the @eros in the range !"$ and is used to tell SM7== to return the
%+th smallest value.
%MI>
The other method is via the BM*1 function. This function is part of the %ata8ase $unctions and
all are extremely useful when?if you need specify multiple criteria. The BM*1 , in the case of
numbers being in 7#
=%MI>AB:AB330B09B:9+!
:here &"& represents the relative column position to average in the range 7"
8/17/2019 Excel Formula Tips and Tricks
68/103
See #lso: spee% up /a +o%e Slo) 9a+ros ,F+el!"# ol%en Rules ,F+el
Seri+es "est 5ra+ti+es | $onsi%er The $o%e!"# #%%in To ,nsure your +o%e is
eB+ient $o%e
Intro
Excel is without doubt a very powerful spreadsheet application and arguably the best in the
world. -owever, many people often design their spreadsheets with no foresight at all. This
means most spreadsheets have poor foundations and have limited life spans. Perhaps the number
one rule when designing a spreadsheet is, we should start with the end in mind and never assume
you will not need to add more data or formulae to your spreadsheet, because, the chances are that
you will. 7 good spreadsheet should have about W) planning and #) implementation. :hile
this can seem extremely inefficient in the short run, * can assure you that the long term gain will
far outweigh the short7term pain. 8emember that spreadsheets are about giving correct information to the user, not possible erroneous information that loo%s good. =et9s loo% at how a
spreadsheet should be set up efficiently.
,F+el "est 5ra+ti+e Desi-n On this pa-e
Rows (Shame on Microsoft )
Formatting (The least important Aspect)
Layout (T$" most important Aspect)
Formulae (This is what it is all about)
Speeding up Recalculations (how to! do"s # dont"s)
Array Formulas (what so called $ormulae gurus Wont Tell %ou)
%&Fs or 'ustom Functions (Rarely reuired)
olatile Functions (A*oid these)
Loo+up Functions (,ow to speed up)
-icroso$t"s Tips For .ptimi/ing Speed ($rom the horses mouth)
.utside Lin+s
01 -icroso$t 2nowledge 3ase Article 456766
61 Recalculation in -icroso$t 89cel
http://www.ozgrid.com/VBA/SpeedingUpVBACode.htmhttp://www.ozgrid.com/VBA/calc-stop.htmhttp://www.ozgrid.com/forum/showthread.php?t=76234http://msdn.microsoft.com/en-us/library/ms545631.aspxhttp://msdn.microsoft.com/en-us/library/ms545631.aspxhttp://www.ozgrid.com/excel-add-ins/vba-code.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Rowshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Formattinghttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Layouthttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Formulaehttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Speeding%20up%20Re-calculationshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Arrayshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#UDFhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Volatile%20Functionshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#LookUphttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Microsoft'sTipshttp://support.microsoft.com/default.aspx?scid=KB;EN-US;Q72622&LN=EN-US&SD=gn&FR=0&qry=optimizing%20worksheets&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLWhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrecalc.asphttp://www.ozgrid.com/VBA/SpeedingUpVBACode.htmhttp://www.ozgrid.com/VBA/calc-stop.htmhttp://www.ozgrid.com/forum/showthread.php?t=76234http://msdn.microsoft.com/en-us/library/ms545631.aspxhttp://msdn.microsoft.com/en-us/library/ms545631.aspxhttp://www.ozgrid.com/excel-add-ins/vba-code.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Rowshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Formattinghttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Layouthttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Formulaehttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Speeding%20up%20Re-calculationshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Arrayshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#UDFhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Volatile%20Functionshttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#LookUphttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Microsoft'sTipshttp://support.microsoft.com/default.aspx?scid=KB;EN-US;Q72622&LN=EN-US&SD=gn&FR=0&qry=optimizing%20worksheets&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLWhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrecalc.asp
8/17/2019 Excel Formula Tips and Tricks
69/103
1 Impro*ing Per$ormance in 89cel 6;;5
8/17/2019 Excel Formula Tips and Tricks
70/103
*f you want your formatting to automatically apply to new data, either use the & Format ainter&
!paint brush icon on the formatting toolbar$. 0r go to Tools3
8/17/2019 Excel Formula Tips and Tricks
71/103
&sgBo$ LastRow
*nd #!
End Su&
7nother common mista%e with cell formatting is the changing of alignment of cell data. 4y
default, num8ers are right aligned and text is le$t aligne"0 leave it this wayH *f you Start
changing this, you will not be able to tell at a glance if the contents of a cell is text or numeric. *t
is very common for people to reference cells, that loo% li%e numbers, when in reality they are
text. *f you have altered the default alignment, you will be left scratching your head. *erhaps the
e
8/17/2019 Excel Formula Tips and Tricks
72/103
%ata /ein- sorte% in a lo-i+al or%er. It )ill also -reatly spee% the +al+ulationpro+ess of many fun+tions.
8/17/2019 Excel Formula Tips and Tricks
73/103
Possibly one of the very best ways to overcome this is to familiari@e yourself with the use of
dynamic named ranges. *f you are not familiar with these, chec% them out here< %-namic
#anges *lease note that for the purpose of being totally generic% the e
8/17/2019 Excel Formula Tips and Tricks
74/103
4elow is a list of what is often the worst offenders for slowing down recalculations of
spreadsheets.
=. #rray formulas
8. Sumpro%u+t use% for multiple +on%ition summin- or +ountin-
6. UD*s 2User%e7ne% fun+tions3
K. !olatile fun+tions
>. (ooup *un+tions
=et9s loo% at each of these now in turn, and see what alternatives we can have for them.
Sprea%sheet #rray *ormulas topV
7 possible alternative for array formulas, are Excel9s "ata8ase $unctions . The Excel help has
some very good examples on how these formulas can be used on large tables of data and are able
to return results based on multiple criteria. 7nother alternative which is too often overloo%ed is
the use of Excel9s i1ot ta8le feature. :hile these may seem very daunting when first
encountered, * highly recommend that you familiari@e yourself with this powerful Excel feature
as once you master them, you will wonder how you survived without themH
Perhaps the biggest problem with array formulae is that they loo% efficient, but when compared
to an alternative, nothing could be further from the truthH 7n array formulae must follow rules
that Excels built in unctions do not have to, that is they must loop through each and every cellthey reference !one at a time$ and chec% them off against a criteria. or this reason arrays are
best suited to being used on single cells or referencing only small ranges.
Sprea%sheet UD*s or $ustom *un+tions topV
UBs for those of you that are not aware, are User+defined unctions that are written with Excel
47 which can then be used in a :or%sheet in the same way as any one of Excel9s built+in
wor%sheet functions. Unfortunately, no matter how good the person is at 47 who has written
the UB, it is very unli%ely that it will perform at the same speed as one of Excel9s built+in
functions, even if it would be necessary to use several nested functions to get the same result.
0ften a well written and e$$icient U%F $unction will incorporate the use of Excel9s wor%sheet
functions. 4y this, * mean you may decide to write a UB to replace a function which otherwise
would re'uire you to use several wor%sheet functions nested within each other. The most
efficient way to replace the use of several nested wor%sheet functions !if you must$ would be to
write a UB that would incorporate the use of all of the wor%sheet functions necessary. This
way instead of having to repeatedly nest the functions on the :or%sheet to get the desired result,
http://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/Excel/Arrays.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Tophttp://www.ozgrid.com/download/DFunctionsWithValidation.ziphttp://www.ozgrid.com/Excel/excel-pivot-tables.htmhttp://www.ozgrid.com/VBA/Functions.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Tophttp://www.ozgrid.com/VBA/Functions.htmhttp://www.ozgrid.com/Excel/sum-if.htmhttp://www.ozgrid.com/Excel/count-if.htmhttp://www.ozgrid.com/Excel/Arrays.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Tophttp://www.ozgrid.com/download/DFunctionsWithValidation.ziphttp://www.ozgrid.com/Excel/excel-pivot-tables.htmhttp://www.ozgrid.com/VBA/Functions.htmhttp://www.ozgrid.com/Excel/ExcelSpreadsheetDesign.htm#Tophttp://www.ozgrid.com/VBA/Functions.htm
8/17/2019 Excel Formula Tips and Tricks
75/103
you could nest the functions once within 47 !by accessing the :or%sheetunction 0bect$
which would then allow you to use this function in the interface, without the need to repeat the
nesting. Most of Excels :or%sheet unctions can be used in 47 simply by using<
&orksheetFunction.Function >ame5 or Application.Function >ame5 if the one you need
is not available, there will be 4 e'uivalent.
Sprea%sheet !olatile *un+tions topV
olatile functions are simple functions that will recalculate each time a change of data occurs in
any cell on any wor%sheet. Most functions !non olatile$ will only recalculate if a cell that they
are referencing has changed. Some of the most common volatile functions used are undoubtedly
the >
8/17/2019 Excel Formula Tips and Tricks
76/103
This is used to prevent the D>)A when no match can be found. The big problem with this is, it
forces Excel to use the =00;UP twiceH 7s you can imagine, this doubles the number of
=oo%up functions used. The best approach !if possible$ is to live with the 1?7, or hide it via
/onditional ormatting . 0r, if this is not an option, place the =oo%up in a 9out+the+way9 spot on
the same :or%sheet !eg *"$ and then use
8/17/2019 Excel Formula Tips and Tricks
77/103
• If you only nee% a fe) +ells to /e re+al+ulate%4 repla+e the eual si-ns 2C3 ofthe +ells you )ant to /e re+al+ulate%. This is only an improement if you are+al+ulatin- a ery small per+enta-e of the formulas on your )orsheet.
• When a +ertain -roup of formulas must /e re+al+ulate% a -reat num/er oftimes4 then it may /e helpful to repla+e the eual si-n 2C3 in the formulasthat you %o not nee% to re+al+ulate )ith a uniue strin- that %oes not appearelse)here. The formulas )ithout the eual si-ns )ill not /e re+al+ulate% 2theyare no lon-er +onsi%ere% formulas3. When 9i+rosoft ,F+el has re+al+ulate%the formulas that still +ontain eual si-ns4 sear+h for the uniue strin- an%restore the C.
". Microsoft ;nowledge 4ase 7rticle + ID#N##
#. 8ecalculation in Microsoft Excel
(. *mproving Performance in Excel #))D
Excel Tips an" Tricks This page consists of many tips and tric%s you can use in Excel, fromshortcut %eys to wor%ing with formulas and functions. *f you %now of a good one, please let us%nowH
;an"- ;ints For Sprea"sheets -ere you will find out how to use Excels /onditionalormatting and Bata alidation. *t explains in detail how you can use these great Excel featuresto wor% with duplications in your spreadsheets. 4est of all it shows how they can be used to prevent themH
%ata ali"ation $or %uplicates in Excel an" Con"itional Formatting $or %uplicates in Excel
Since Excel CD Excel has some very handy built in features that are ideal for spreadsheets. 7llthat is needed is a bit of imagination and %now how and these can be adopted to ma%e life ustthat bit easier. The examples below ma%e use of %ata ali"ation and Con"itional Formatting to both find duplicates in Excel and prevent them. *f you do a lot of duplicationhunting?managing in Excel see our Excel %uplicates Manager Excel A""7in.
ali"ation For %uplicates
5o here if you are not familiar with %ata ali"ation
alidation can be found by going to %ata5ali"ation on the Toolbar. The main purpose of thisfunction is to set up restrictions so users can only enter data that meet the criteria that you set, butas you will also see it can be used in other ways. For the purpose o$ all examples e illassume the range o$ cells that users ill 8e entering "ata in is AB:;B3.
HIMTH ali"ation "oes not pre1ent users $rom "eleting or pasting.
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q72622&LN=EN-US&SD=gn&FR=0&qry=optimizing%20worksheets&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLWhttp://support.microsoft.com/default.aspx?scid=KB;EN-US;Q72622&LN=EN-US&SD=gn&FR=0&qry=optimizing%20worksheets&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLWhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrecalc.asphttp://msdn2.microsoft.com/en-au/library/aa730921.aspxhttp://www.ozgrid.com/Excel/TipsAndTricks.htmhttp://www.ozgrid.com/Excel/Formulas.htmhttp://www.ozgrid.com/Excel/Formulas.htmhttp://www.ozgrid.com/Excel/Formulas.htm#VALIDATIONhttp://www.ozgrid.com/Excel/Formulas.htm#CONDFORMhttp://www.ozgrid.com/Services/Excel_Duplication_Add-in.htmhttp://www.ozgrid.com/Services/Excel_Duplication_Add-in.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://www.ozgrid.com/Excel/data-validation.htmhttp://support.microsoft.com/default.aspx?scid=KB;EN-US;Q72622&LN=EN-US&SD=gn&FR=0&qry=optimizing%20worksheets&rnk=1&src=DHCS_MSPSS_gn_SRCH&SPR=XLWhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrecalc.asphttp://msdn2.microsoft.com/en-au/library/aa730921.aspxhttp://www.ozgrid.com/Excel/TipsAndTricks.htmhttp://www.ozgrid.com/Excel/Formulas.htmhttp://www.ozgrid.com/Excel/Formulas.htm#VALIDATIONhttp://www.ozgrid.com/Excel/Formulas.htm#CONDFORMhttp://www.ozgrid.com/Services/Excel_Duplication_Add-in.htmhttp://www.ozgrid.co