Você está na página 1de 103

Summing Formulas

Excel SUM Formula Probably, the most widely used Excel formula, the SUM function in Excel
is 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 Formula
bar.

Excel SUM Function/Formula. Add Numbers, or a Range of Cells


With 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 Function can be typed into a cell in Excel, or inserted via the Insert Function tool to the
left of your Formula bar. The syntax of the SUM Function is SUM(number1,number2, ...). SUM
is the function name, and contained within the brackets are "arguments", or the pieces of
information that Excel requires to complete the Function. The SUM function allows from 1 to
30 arguments (number 1, number ....) for which you require the total value or SUM.
Using Ctrl to Mark Cells
If you wish to add cells that are non-contiguous (not joined together), type in your function
=SUM( click in the first cell you wish to add. Hold down your Ctrl key and click in all other
cells you wish to add up, then type in a ). Typing in a comma instead of selecting with your Ctrl
key also works just as efficiently as well.
Using SUM to Add a Range from a Different Worksheet
You can easily use SUM to add up the same range in different worksheets. Click in the cell you
want the result of your addition in, then holding down the Shift key, click on the next worksheet
that you wish to include in your calculation and highlight the range to be used, then click Enter.
One thing to note here however, is that if you insert a worksheet in the middle of the range that
you have told the SUM function to add, then the same range on that worksheet will be included
in your sum.
TIP! If you wish to force any new inserted worksheets to be included in the SUM range, try
this. insert a blank worksheet at the beginning of your sheets in your workbook, and a blank
sheet at the end. Now in the cell that you wish the result of your addition to appear in type in
=SUM( and then click on the new first blank worksheet and highlight the range you require to be

added in all worksheets. Hold down your Shift key and click on the new last blank worksheet,
then close your bracket ) and hit enter. Now hide the first sheet and the last sheet by going to
Format>Sheet>Hide. This will force any new worksheets to be included in the SUM range as all
new worksheets will be between the 2 blank ones.

Excel Autosum Function Because adding numbers is probably the most common function that
Excel is used for, Excel has a built-in Feature called AutoSum located on the Standard toolbar.

Excel Autosum. Sum up Values in Excel Automatically


Excel's AutoSum Function. See Also: SUM Formula/Function || Excel AutoSum ||
AutoSum Tips 2 and AutoSum Tips 3
Because adding numbers is probably the most common function that Excel is used for, Excel has
a built-in Feature called AutoSum located on the Standard toolbar. AutoSum is represented as
the Greek Capital letter Sigma . You can use AutoSum to sum a range of cells. A Range can
be one single cell, or many cells. You can sum cells in a contiguous (no gaps) range of cells, or a
non-contiguous (cells not joined together) range.
To use AutoSum you must click in the cell that you wish your result, or addition to appear in.
As a default, AutoSum looks up a column for figures immediately above it to add together. This
works great, unless it encounters a blank row or text. If it does, then it stops at the last cell with
a number in it. If there are no numbers above it, AutoSum will automatically go to the left
looking for numbers to add up, but will again stop at a blank column or text. This is Excel's
default, but you can easily change it.

The SUM Function is written as =SUM(number 1, number 2). = is the trigger to Excel that a
function or formula is following. SUM is the name of the function and (number 1, number 2) are
the arguments that the SUM function needs to work, or in our case the numbers it is to add up.
When you click the AutoSum icon, you will see the SUM function written in your cell, with a
marquee (floating dotted line) around what the AutoSum intends to add up. If the highlighted
range is what you wanted to add up, click OK, if not then change the range you wish to add.
Following are three screen shots showing the AutoSum.
AutoSum automatically picks up the numbers above it

AutoSum automatically looks left for numbers if it encounters no numbers immediately above it,
but numbers to the left.

AutoSum automatically stops when it encounters a blank line, or text in the middle of the range
it is trying to add up.

Array Formulas in Excel I strongly suggest you read this very


important information on using array formulas in your
spreadsheets. Array formulas can let you specify more then one
criteria to Sum, Average, Count etc by. Many examples of how to
use them.

Array Formulas - Excel Array Formulas


ShareThis | | Information Helpful? Why Not Donate.
TRY OUT: Smart-VBA | Code-VBA | Analyzer-XL |
Downloader-XL | Trader-XL| More Free Downloads.. Best
Value: Finance Templates Bundle

What are Array Formulas? See Also Alternative


to Array Formulas
Excel Array formulas are very powerful and useful formulas that
allow more complex calculations than standard formulas. The
"Help" in Excel defines them as below:

"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
When I first discovered array formulas may years ago, I thought I had found the answer to ALL
my spreadsheet problems. I Started using them willy nilly and paid the the price.
Perhaps the number one rule with arrays is, only use them when needed and know when to use
them. I have seen many users using array formulas in instances when a standard Excel formula
will do the job (eg; one of the database functions). Too many array formulas WILL slow down
recalculation, saving, opening and closing.
I have even seen "so called" experienced users recommending them to other Excel users looking
for help on a simple formula. This is usually due to inexperience and/or laziness. This is very
irresponsible, as the person looking for help will also find themselves using them as their first
port of call. So it is important to know when to use them and when not to. See Efficient Excel
Spreadsheet Design
It is fair to say that even my examples below are really an incorrect use of array formulas, but in
the interest of keeping things simple I have used them.
Array Formula Rules:
Before we show some examples of array formulas it is important to know 4 fundamental rules.

Each argument within an array must have the same amount of rows and columns.

You must enter an array by pushing Ctrl+Shift+Enter.

You cannot add the {} (braces) that surround an array yourself, pushing
Ctrl+Shift+Enter will do this for you.

You cannot use an array formula on an entire column.

Pet Shop Example:


Suppose you have 5 Columns of data each with 200 rows.
Column A is used to keep track of the sex of each dog sold i.e. Male or Female
Column B is used to keep track of the breed of the dogs sold.
Column C is used to keep track of the age of the dogs sold.
Column D is used to keep track whether the dog is sterilized or not i.e. Yes or No
Column E is used to keep track of the cost of the dog sold.

To count the number of male Poodles sold:


=SUM(($A$2:$A$200="Male")*($B$2:$B$200="Poodle"))

To count the number of male Poodles sold over 3 years old:


=SUM(($A$2:$A$200="Male")*($B$2:$B$200="Poodle")*($C$2:$C$200>2))

To get the total cost of male Spaniels sold:


=SUM(IF($A$2:$A$200="Male",IF($B$2:$B$200="Spaniel",
$E$2:$E$200,0),0))

To find out the average age of male dogs sold:


=AVERAGE(IF($A$2:$A$200="Male",$C$2:$C$200))

To find out the average cost of male dogs sold over 2 years old:
=AVERAGE(IF($A$2:$A$200="Male",IF($C$2:$C$200>2,$E$2:$E$200)))

To find out the Minimum age of dogs sold that are sterilized:
=MIN(IF($D$2:$D$200="Yes",$C$2:$C$200))

All the above formulas must be entered with Ctrl+Shift+Enter


TIP: If you are having problems writing an array formula to sum your totals then use the
Conditional sum wizard, Tool>Wizard>Conditional sum. If you don't see it then you will need
to add it via Tools>Add-ins>Conditional sum wizard.
While using array formulas can be very handy they have one draw back and that is, too many of
them within your workbook WILL slow down Excels recalculations. If you have read and
understood the very real pit-falls to using them I highly recommend taking the next step and
going here : But please keep in mind what I have said here.

Excel Conditional Sum Wizard The Conditional Sum Wizard is an Add-In to Excel that is used
to summarize values in a list based on set criteria.

Summing by More Than 1 Criteria


Complete Excel Excel Training Course for Excel 97 - Excel 2003, only $145.00.
$59.95 Instant Buy/Download, 30 Day Money Back Guarantee & Free Excel Help for LIFE!
Current Special!

Got any Excel Questions? Free Excel Help . See Also: Sum With Multiple Criteria and
Count With Multiple Criteria
Excel Sum Wizard

The Conditional Sum Wizard is an Add-In to Excel that is used to summarise values in a list
based on set criteria. An example of how the Conditional Sum Wizard can be used is on a list of
data that contains basketball teams and number of points scored over a period of time. By using
the Conditional Sum Wizard you can create a formula to add the total points for a team over a
specified period.
Because the Conditional Sum Wizard is an Add-In to Excel, you will need to install it (you may
need your Office disk to do this). To install the Conditional Sum Wizard go to Tools>AddIns,
then select Conditional Sum Wizard until it has a tick in the box to the left, then click OK.
Once done the Conditional Sum Wizard will be available to you under the Tools Menu.
USING ONE CONDITION
Lets say we have a list of dates from A2:A32 (with a heading of Dates in A1, bolded and
centered). From B2:B32 is a list of basketball teams (with a heading of Teams in B1 that has
been bolded and centered) and the points recorded in C2:C32 (heading of Points in C1 also
bolded and centered). We want to find out the total points scored for the Black Crows basketball
team.

Now click inside your list range and to go Tools>Conditional Sum Wizard. A Wizard is a mini
program that steps you through a process and you should be looking at Step 1 of the Wizard,
which asks the question;
Where is the list that contains the values to sum, including the column labels?
Because you were already clicked inside your list when you activated the Conditional Sum
Wizard, and because your headings are defined as different to your list, Excel, will automatically
pick up your list range of $A$1:$C$32, so all you need to do here is click the Next button.
This brings you to Step 2 of the Wizard which asks you:
Which column contains the value to sum? Select the column label.
We need to select Points from the drop down list as this is the column in which we are looking
for our values to sum.
Next we are asked to select a column that we wish to evaluate, and then type or select a value to

compare with data in that column.


Make the following selections;
Under column Select Team
Under Is: - Select =
Under This Value - Select Black Crows
Now select Add Condition. This will add the condition to the Conditional Sum dialog
Click the Next button to take you to Step 3 of the Wizard.
In Step 3 we are asked in which form we would like the formula copied to our worksheet. There
are two choices;
Copy just the formula to a single cell
Copy the formula and conditional values
We will accept the default, copying the formula to a single cell.
Click the Next button to take you to the final step (Step 4) of the Wizard where we are asked to
type or select a cell.
Select cell G2 and click Finish.
You will notice when you click finish and can view the formula in cell G2 of your worksheet that
it has been pasted as an ARRAY formula .
USING TWO CONDITIONS
You can easily use more than one condition with the Conditional Sum Wizard. Lets see how
many points were scored overall between 25 March and 26 April 2006.
Click inside your list and go to Tools>Conditional Sum Wizard. Your list range will be
automatically picked up. Click Next to go to Step 2.
Under Step 2, select Points as the column to sum at the top of the dialog.
Make the following changes for the columns you with to evaluate:
Under column Select Date

Under Is: - Select >=


Under This Value type 25 March 2006
Now select Add Condition. This will add the first condition to the Conditional Sum dialog
Now to add the second condition:
Under column Select Date
Under Is: - Select <=
Under This Value type 26 April 2006
Again select Add Condition. This will add the second condition to the Conditional Sum dialog.
Click the Next button
This will take you to Step 3 of the Wizard where we are asked in which form we would like the
formula copied to our worksheet. This time we will select the second option; copy the formula
and conditional values. Select the Next button.
In Step 4 of the Wizard you are asked to nominate a cell in which to paste your formula.
Nominate cell G4 and click Finish. This will paste the first date (25/03/06) to cell G2. Now
select cell H2 and again click Finish. This will paste the second date (26/04/06) to sell H2. Now
select I2 and click Finish. This will paste the number of points scored between 25/03/06 and
26/04/06 to I2

Sum With Multiple Criteria Examples of Excel formulas to sum a range of cells that meet
multiple criteria. ,DSUM, SUMPRODUCT and SUM with an IF function/formula.
IF YOU ARE USING 2007 or above, USE SUMIFS

There are many times that it become necessary to SUM cells based on multiple criteria. The
examples below will show you 3 ways that this can be done. However, often the most efficient
method is to use a Pivot Table If you are not familiar with Pivot Tables, I cannot stress enough
how much easier spreadsheet life becomes once you are!
If you are not already aware, the Excel SUMIF formula/function can only check to see if
specified cells meet one condition, e.g.
SUMIF Syntax
=SUMIF(range,criteria,sum_range)
=SUMIF(A1:A10,">20",B1:B10)
Which would SUM all numeric cells in the range B1:B20 where the corresponding row in
A1:A10 was greater than 20. If we ommit the last optional argument (sum_range) the SUMIF
would sum all cells in the range A1:A10 which are greater than 20, i.e.
=SUMIF(A1:A10,">20")
Note the criteria argument is in the form of a number, expression, or text that defines which cells
will be summed. For example, criteria can be expressed as 20, "20", "=20", ">20", "North",
"N*".
Ok, so if we need to sum a range of cells where corresponding cells (on the same row) meet 2, or
more conditions we can no longer use the SUMIF. The formulas we can use, in order of their
efficiency, are
1) DSUM Download advanced examples of DSUM
2) SUMPRODUCT
3) SUM with and IF function nested and entered as an array formula. See Array Formulas for
details
For all examples I will use the data as shown below. Where A2:E25 has been named: DataTable

DSUM
Adds the numbers in a column of a list, or database, that match criteria you specify. For example;
=DSUM(DataTable,B2,Criteria)
Would Sum all cells in B2:B25 that meet the criteria is the named range: Criteria (shown below)

The top row of the range: Criteria has exact copies of the headings in the range DataTable . The
reference to cell B2 is telling the DSUM to sum the numbers in B2:B25 that meet the criteria.
We could replace the reference to B2 with the text "Quantity", or the number 2 as the "Quantity"
column is the second column in the table.
The criteria text "Bourbon" and "Vodka", under the criteria table heading "Description", tells
DSUM that either "Bourbon" OR "Vodka" is a match. The same principle is used for the
"Alcohol Content", i.e. "High" OR "Low". This is then seen by DSUM as an OR condition.
Note the repeat of the date under "Use By Date". This is needed when using more than 2 rows as

the criteria as a blank cell is seen as a wildcard character. If we wanted to sum only data that lies
between 2 dates, we would need have 2 "Use By Date" headings in our Criteria range and use:
>7-Apr-2005 below one of these headings and <7-Jun-2005 under another. This is then seen by
DSUM as an AND condition.
Download advanced examples of DSUM
SUMPRODUCT
Multiplies corresponding values in the given arrays, and returns the sum of those
products=SUMPRODUCT((A3:A25="Vodka")*(C3:C25>VALUE("7-Apr2005"))*(E3:E25="High")*(B3:B25))
+SUMPRODUCT((A3:A25="Bourbon")*(C3:C25>VALUE("7-Apr2005"))*(E3:E25="Low")*(B3:B25))
As with the first DSUM example, the above SUMPRODUCT example would sum all "Quantity"
values where the corresponding "Use By Date" is greater than 7-Apr-2005, the "Description" is
either "Vodka" OR "Bourbon" and the "Alcohol Content" is "High" OR "Low".
Note how range for each column of the table Start s at row 3 and not row 2. This is because the
SUMPRODUCT has the result of each criteria check returned as TRUE (has a value of 1) or
FALSE (has a value of 0). So, in the first row check (if we used row 2) it would look
like;=SUMPRODUCT(0)*(0))*(0)*("Quantity"))+SUMPRODUCT((0)*(0)*(0)*("Quantity"))To
read about this in detail, see our April edition of our free Excel Newsletter
The result of multiplying a text string is always #VALUE! This would cause the result of the
SUMPRODUCT to return the #VALUE! error.
SUM and IF=SUM(IF(A2:A25="Bourbon",IF(C2:C25>VALUE("7-Apr2005"),IF(E2:E25="Low",B2:B25)))+SUM(IF(A2:A25="Vodka",IF(C2:C25>VALUE("7-Apr2005"),IF(E2:E25="High",B2:B25)))))
The above, does the same as the SUMPRODUCT example. However, this is an array formula
and must be entered by pushing Ctrl+Shift+Enter
It is important to know that using the SUM and IF or the SUMPRODUCT over a large number
of cells will cause a noticeable slow down in Excel's recalculation time. The DSUM is far more
efficient in this regard. However, as stated at the very Start , a Pivot Table is better still when
done correctly.
Sum Every nth Cell

Surprising at it may seem, it is not as uncommon as you may think for an Excel user to want to
sum every 2nd, 3rd, 4th etc cell in a spreadsheet. Excel has no standard Function that will do
this. However, it can be done it a number of different ways. All these ways make use of the
ROW Function and the MOD Function.
ROW Function
Returns the row number of a single cell reference.
Syntax: ROW(reference)
MODFunction
Returns the remainder after number is divided by divisor. The result has the same sign as the
divisor.
Syntax: MOD(number,divisor)
We nest the ROW function within the MOD function (to supply the number argument), divide it
by 2 (to sum every second cell) and check to see if the result is 0 (zero). If it is, then the cell is
summed.
Let's look at just how we can use these. Some ways are better than others. By this I mean, we can
use an array formula , but arrays are best suited to referencing either, single cells or small ranges.
Having too many arrays that reference a large range will slow down Excel's recalculation time. I
have seen many Workbooks that have become unusable due to array formulae. An array
formula to SUM every 2nd cell could look like;
=SUM(IF(MOD(ROW($A$1:$A$500),2)=0,$A$1:$A$500,0))
As this is an array formula it must be entered by pushing Ctrl+Shift+Enter and then Excel will
add the curly brackets so it looks like;
{=SUM(IF(MOD(ROW($A$1:$A$500),2)=0,$A$1:$A$500,0))}
You must let Excel add these. Adding them yourself will cause the array formula not to work.
While this will do the job, it is not good spreadsheet design to do so. The reason is, it is an
unnecessary use of an array formula and to make matters worse, it has the Volatile ROW
Function nested within it, making the whole array formula Volatile. This would mean the
formula would be constantly recalculating whenever you are working in the Workbook. In a
nutshell it is bad way to go!
Another formula we can use, which is a slightly better choice, than the above array formula, is;
=SUMPRODUCT((MOD(ROW($A$1:$A$500),2)=0)*($A$1:$A$500))

You should however be aware that it will return #VALUE! if any cells in the range contain text.
This formula, while not a true array formula, will also slow down Excel if too many are used
and/or they reference a large range.
Ok, enough of how we shouldn't do this, lets look at a much better way that is not only more
efficient but also far more flexible. For this we will use the DSUM function. For the example I
will use the range A1:A500 as the range we need to sum every nth cell.
1. Enter the word Criteria in cell E1
2. In cell E2 enter the formula: =MOD(ROW(A2),$C$2)=0
3. Select cell C2 and go to Data>Validation and select List from the Allow: box and in the
Source: box type: 1,2,3,4,5,6,7,8,9,10
4. Ensure the In-cell dropdown is checked and click OK
5. In cell C1 enter: SUM every.
6. In any cell after row 1 enter this formula: =DSUM($A:$A,1,$E$1:$E$2)
7. OPTIONAL: In the cell directly above, where you have entered the DSUM enter;
="Summing Every
"&$C$2&CHOOSE($C$2,"st","nd","rd","th","th","th","th","th","th","th") & " Cell"
Now all you need to do is choose the desired number from cell C2 and the DSUM will do the
rest.

Download a Workbook Example

Also See This Workbook

Sum nth Largest/Smallest

How To Sum The Top Or Bottom X Numbers


When you have a list of number in an Excel spreadsheet there are times when you may have to
Sum only the top x numbers in the list. If the numbers are sorted then the task is a fairly
straightforward Sum function including on the top, or bottom x cells. Often however this is not
the case.
Lets say we have a list of number in the range A1:A100 and we have to sum only the 10
largest/smallest figures. We can do this by nesting the LARGE function into the SUM function as
shown below. CAUTION: Array formulas and SUMPRODUCT (used for this purpose) are
VERY inefficient and have serious limitations. I advise to use DSUM (shown below) or a
PivotTable
=SUM(LARGE($A$2:$A$100,{1,2,3,4,5,6,7,8,9,10}))
This is an array formula and must be entered via Ctrl+Shift+Enter and your list cannot
contain text
If we only needed the 5 largest, we would simply omit the numbers 6 to 10. If we needed to sum
the 15 largest number we simply add number 11 to 15.
Should we need to sum the 10 smallest values in the list we could use
=SUM(SMALL($A$2:$A$100,{1,2,3,4,5,6,7,8,9,10}))
This is an array formula and must be entered via Ctrl+Shift+Enter and your list cannot
contain text

SUMPRODUCT
=SUMPRODUCT(($A$2:$A$100>LARGE($A$2:$A$100,9))*($A$2:$A$100))
Your list cannot contain text

DSUM THE BEST WAY


Use of the DSUM Function requires A1 to be a Heading.
1. In any spare column add the text Criteria
2. Directly below this Enter either
=A1>LARGE($A$1:$A$100,9) OR
=A1<SMAll($A$1:$A$100,9)

3. Where you want the result, Enter


=DSUM($A$1:$A$100,1,$C$1:$C$2)
Where C1=Criteria and C2=A1>LARGE($A$1:$A$100,9) OR =A1<SMAll($A$1:$A$100,9)
Where 1 is the relative Column position of the Column you are summing. Your MUST have a
heading but your list CAN contain text.

Sum Cells by Color


Want to Sum or Count cells that have a specified Fill Color? This can be done with the aid of
a Custom Function. A custom function, also called a User Defined Function, is a function that
we write ourselves using VBA (Visual Basic for Applications). Here is how
See Also: 2 Separate Functions Here and Excel Sort by Color
First open the Workbook in which you wish to count or sum cells by a fill color. Now go into the
Visual Basic Editor via Tools>Macro>Visual Basic Editor (Alt+F11) and then, from within the
Visual Basic Editor go to Insert>Module to insert a standard module. Now, in this module,
enter in the code as shown below;
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As
Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult

''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com

'Sums or counts cells based on a specified fill color.


'''''''''''''''''''''''''''''''''''''''

lCol = rColor.Interior.ColorIndex

If SUM = True Then


For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell,vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If

ColorFunction = vResult
End Function

You can now use the custom function (ColorFunction) like;


=ColorFunction($C$1,$A$1:$A$12,TRUE) to SUM the values in range of cells $A$1:$A$12
that have the same fill color as cell $C$1. The reason it will SUM in this example is because we
have used TRUE as the last argument for the custom function.
To COUNT these cells that have the same fill color as cell $C$1 you could use:
=ColorFunction($C$1,$A$1:$A$12,FALSE) or =ColorFunction($C$1,$A$1:$A$12) by
omitting the last argument our function will automatically default to using FALSE.
Be aware that the changing of a cells fill color will not cause the Custom Function to recalculate,
even if you press F9 (Recalculates the whole Workbook). You will need to either, select the cell
and re-enter the formula, or go to Edit>Replace and replace = with =, or use Ctrl+Alt+F9

Try also to avoid the use of Application.Volatile as it will not help in this case and only slow
down Excel's calculation time.

Increase/Decrease Values If you have values on an Excel Worksheet that you need to
permanently increase, or decrease you can use Paste Special. No Excel formulas needed!

Excel: Increase Excel Values by Percentage (%), Multiply, Add,


Subtract or Divide
Complete Excel Excel Training Course for Excel 97 - Excel 2003, only $145.00.
$59.95 Instant Buy/Download, 30 Day Money Back Guarantee & Free Excel Help for LIFE!
Current Special!

Got any Excel Questions? Free Excel Help


Increase/Decrease Excel Values
If you have values on an Excel Worksheet that you need to permanently increase, or decrease
you can use Paste Special.
Increase/Decrease Excel Values by Percentage
Let's say you have a list of values in A1:A100 and you need to increase these values all by 15%.
Here is how;
1. Enter the number 1.15 into any blank cell and then Copy it
2. Now select the range A1:A100 and go to Edit>Paste Special
3. Choose Values from under Paste and then Multiply under Operation and
click OK.

All value will now have increased by 15%


To decrease the values by 15% you would simply Enter =1 - 0.15 in any blank cell as apposed
to 1.15. This would result in 0.85 which when used in steps 2 and 3 above, would result in values
being decreased by 15%

Excel Subtotals In Excel we can use the Subtotals feature found under Data on the Worksheet
Menu Bar to Subtotal a table of data.

In Excel we can use the Subtotals feature found under Data on the Worksheet Menu Bar to
Subtotal a table of data. When doing so it is imperative that the table of data is sorted by the
column you wish to Subtotal ("at each change in"). The Subtotal can be in the form of COUNT,
COUNT NUMS SUM, AVERAGE, MIN, MAX, PRODUCT, STDDEV, STDDEVP, VAR or
VARP. Let's use the table below to apply subtotals so we can get a count by "Description".

As you can see, the table has been sorted by the "Description" column. This is required if we
wish to use the "Description" column to get a Subtotal count. It is important to note that Count in
this case is not a count of only numbers like the COUNT Worksheet Function. For that, we
would use Count Nums.
The picture below now shows us what it looks like after applying Subtotals and also the settings
we have used.

Let's now say we wanted to do a Subtotal by Month using the "Use By Date" dates . To achieve
this we would need to add/use an extra column, which can hide if preferred, and have a formula
that changes number and each change in month. The other thing we would need to do is sort

the table by the "Use By Date" column. The formula we would use in an extra column, say "F"
would be as shown below;
=MONTH(C3)
We would copy this down to the last row that has a date in "Use By Date". If F2 we could use the
heading "Month". This would then give us a column of numbers that only change when the
month in the referenced "Use By Date" column changes. We would then simply apply
Subtotals as shown above using the "Months" column. Note that in this case, as the table has
been sorted by "Use By Date" we do not need to re-sort the table by "Month". We could, but the
result would be exactly the same.

Bold Excel Subtotals Here is how we can use Conditional Formatting in Excel to automatically
bold the results of Subtotals.
One issue that is often encountered when working in Excel is that the Subtotal results, via
Data>Subtotals are not bolded or made easily distinguishable. This can make the resulting data
very hard to read, especially if the table that we have applied Subtotals to contains many
columns. This often means the resulting subtotals are over to the right, while their associated
heading are often in the first column.
Consider the small example below where Subtotals have been added to a very small table of
data.
Before Subtotals
A
1

B
Quarter

Cost

2 Quart1

$10.00

3 Quart1

$20.00

4 Quart1

$10.00

5 Quart2

$10.00

6 Quart2

$10.00

7 Quart3

$15.00

9 Quart3

$10.00

1
Quart3
0

$25.00

After Subtotals

A
1

B
Quarter

Cost

2 Quart1

$10.00

3 Quart1

$20.00

4 Quart1

$10.00

5 Quart1 Total

$40.00

6 Quart2

$10.00

7 Quart2

$10.00

8 Quart2 Total

$20.00

9 Quart3

$15.00

1
Quart3
0

$10.00

1
Quart3
1

$25.00

1
Quart2 Total
2

$50.00

1
Grand Total
3

$110.00

In the above table our Subtotal headings have been bolded by Excel, yet their associated results
have not. As this table only has two columns, it is not that hard to read and pick-out the Subtotal
amounts. The more columns that a table has, the harder it becomes to visually pick-out the
Subtotals.
The Solution
The solution to this problem is to make use of Excels Conditional Formatting. Using the above
table as an example try this before adding your Subtotals.
1. Select A1:B10, ensuring the A1 is the active cell.
2. Go to Format>Conditional Formatting
3. Select Formula is: and then add this formula: =RIGHT($A1,5)="Total"
4. Now click the Format button and then the Font tab and then select Bold from Font
Style:
5. Now click OK, then OK again
The all important part to the formula is the Absolute of the Column ($A) and the Relative
reference of the Row (1). As we Start ed our selection from A1, Excel will automatically change

the formula for each cell. For example, cell A2 will have a Conditional Format formula of:
=RIGHT($A2,5)="Total", cell B2 will also have =RIGHT($A2,5)="Total" and cell A3 and B3
will have: =RIGHT($A3,5)="Total".
Now add your Subtotals and your Subtotals will look like:
A
1

B
Quarter

Cost

2 Quart1

$10.00

3 Quart1

$20.00

4 Quart1

$10.00

5 Quart1 Total

$40.00

6 Quart2

$10.00

7 Quart2

$10.00

8 Quart2 Total

$20.00

9 Quart3

$15.00

1
Quart3
0

$10.00

1
Quart3
1

$25.00

1
Quart2 Total
2

$50.00

1
Grand Total
3

$110.00

When you remove the Subtotals, the bolded font will no longer apply.
Taking It One Step Further
The only problem with the above table now is the Grand Total is bolded the same as the
Subtotals. For Grand Totals I prefer to see these formatted different again. Here is how we can do
this. Again the steps are based on the above examples
1. Select A1:B10, ensuring the A1 is the active cell.
2. Go to Format>Conditional Formatting
3. Select Formula is: and then add this formula: =$A1="Grand Total"
4. Now click the Format button and then the Font tab and then select Bold from Font
Style:

5. Click Ok, then click Add to add a second Format Condition


6. Select Formula is: and then add this formula: =RIGHT($A1,5)="Total"
7. Now click the Format button and then the Font tab and then select Bold Italic from
Font Style: and then Single from Underline:
8. Now click OK, then OK again
Your Subtotals will now look like below
A
1

B
Quarter

Cost

2 Quart1

$10.00

3 Quart1

$20.00

4 Quart1

$10.00

5 Quart1 Total

$40.00

6 Quart2

$10.00

7 Quart2

$10.00

8 Quart2 Total

$20.00

9 Quart3

$15.00

1
Quart3
0

$10.00

1
Quart3
1

$25.00

1
Quart2 Total
2

$50.00

1
Grand Total
3

$110.00

You can of course use any format you like to make your Subtotals easier to read.

Making the SUBTOTAL Function Dynamic How to use the one function (not feature as
above) to perform a chosen operation on only visible cells after using Auto Filter.
The SUBTOTAL Function in Excel is used to perform a specified function on a range of Auto
filtered cells. When the Auto Filter has been applied the SUBTOTAL function will only use the
visible cells, all hidden rows are ignored. The operation performed is solely dependent on the
number (between 1 and 11) that we supply to it's first argument Function_num For example;

=SUBTOTAL(1,A1:A100)
will Average all visible cell in the range A1:A100 after an Auto Filter has been applied. If all
rows in A1:A100 are visible it will simply Average them all and give the same result as
=AVERAGE(A1:A100)
The number for the first SUBTOTAL argument, Function_num, and it's corresponding function
are as shown below

Function_Num
1
2
3
4
5
6
7
8
9
10
11

Function
AVERAGE
COUNT
COUNTA
MAX
MIN
PRODUCT
STDEV
STDEVP
SUM
VAR
VARP

As we only need to use a number between 1 and 11 we can have the one SUBTOTAL function
perform a function of our choice. We can even make the choice from a drop-down list which
resides in any cell. Here is how;
1. Add all the function names, in the same order as above, to a range of cells. I will use
D1:D11
2. With this range selected, click in the Name Box (white box left of the Formula Bar) and
type the name: Subs and then click Enter.
3. Select all of Column D and go to Format>Column>Hide
4. Go to View>Toolbars>Forms and then click on the Combo box Control and click cell
C2
5. Use the Size Handles to size the combo box so it can display the longest function name,
i.e AVERAGE

6. Right click on the Combo box and choose Format control then the Control tab.
7. In the Input range: type: Subs In the Cell link: box type:$C$2 Change the Drop down
lines: to 11
8. In cell C3 Enter this formula: =IF($C$2="","","Result of "&INDEX(Subs,$C$2))
9. In cell C4 Enter this formula: =IF($C$2="","",SUBTOTAL($C$2,$A$4:$A$100)) Where
$A$4:$A$100 is the range the SUBTOTAL should act on.
Now all you need to do is select the required SUBTOTAL function from the Combo box and the
correct result will be displayed.

Excel Data Tables Data Tables are a range of cells that are used for testing and analyzing
outcomes on a large scale.
Excel Data Tables
Download Data Table example workbook
Data Tables are a range of cells that are used for testing and analyzing outcomes on a large
scale.
A Data Table will show you how by changing certain values in your formulas you can affect the
result of your formula. Data Tables can store the results of many different scenarios for you in
one table, so that you can analyze them to select which scenario is your best option. The results
are then written into a table form in your Workbook in a location specified by you. Data Tables
are written as array formulas , which therefore allows them to perform multiple calculations in
a single location.
There are two types of Data Tables, One-variable data tables and two-variable data tables.
One-variable data tables
The first thing you must do is to create a base or test model and tell your Data Table which
formulas from your base model you want to test. This is easily done from inside the Data Table
by placing a formula to reference the formula in the base model.
Here is an example:
Lets say that we wish to purchase a new tractor for work on our family farm. We need to know
that if interest rates fluctuate we can still afford to pay for the tractor. So we need to know what
our loan repayments will be, what our total repayments will be and how much interest we are
paying.

1. Open the attached workbook on the Base Model worksheet. The highlighted cells
contain formulas.
2. Now click on the Worksheet tab named OneVariable Table and notice that this has
exactly the same data as the previous table, plus an additional area already set up for the
Data Table.
3. Click in cell E3 and type in =B11, which is the Monthly Loan Repayment
4. Click in F3 and type in =B13 which is the Total Repayment.
5. Click in G3 and type in =B14 which is the Total Amount of Interest Paid.
6. Highlight the range of the table D3:G9, click Data>Table
7. Leave the first box, Row input cell, blank. Nothing is required for a one-variable table
8. Click in Column input cell, click on the collapse dialog button and select cell B5 which
contains the original interest rate of 8.97%
9. Collapse back through to your Table dialog box and select OK.
You should now see the results of the calculations given the values entered in D4:D9 that would
appear in cells B11, B13, and B14 of your base model pasted into the table.
Two-variable Data Tables
You can use a two-variable Data Table to gauge the effect on one formula by changing the
value of two input cells within the one table. With this type of table, you can nominate two
series of data that can be placed back into the original model into two different input cells. Using
the example above, this means that you could nominate a series of interest rates to place in the
original interest rate cell (B5) and a series of loan terms to place in the Term of Loan cell (B7).
When creating a two-variable table, one series is entered into the first column of the table and the
other into the first row of the table. As when creating a one-variable table, the formula reference
that we want to test needs to be placed into the blank cell at the top of the first column of the
table. The attached workbook shows an example of a Two-variable Data Table.
Rules
A couple of rules for Data Tables:
1. Set up a "base model"
2. Do not change the values in the "base model"

3. It is a good idea to document the area around your data table, so you and other users can
tell what it is you are analysing.
4. You can use Data Tables to change up to two variables only
5. You can create as many one-variable or two-variable Data Tables as you like in a
Workbook.
Download Data Table example workbook

Sum Between Date Ranges

SUMMING NUMBERS BETWEEN DATE RANGES. See also: Count


between date ranges
Let's take this a step further and sum up numbers in Column "B" that correspond to our date
range.
=SUMPRODUCT(($A$1:$A$20>DATE(2010,7,29))*($A$1:$A$20<DATE(2010,8,1))*($B$1
:$B$20))
We can even add another condition to numbers in Column B. Say we only want to sum numbers,
in range B1:20, that are greater than 3. We would use;
=SUMPRODUCT(($A$1:$A$20>DATE(2010,7,29))*($A$1:$A$20<DATE(2010,8,1))*($B$1
:$B$20>3)*($B$1:$B$20))

Count With Multiple Criteria Examples of Excel formulas to count a range of cells that meet
multiple criteria. ,DCOUNT, DCOUNTA, and SUM with an IF function/formula.
There are many times that it become necessary to COUNT cells based on multiple criteria. The
examples below will show you 3 ways that this can be done. However, often the most efficient
method is to use a Pivot Table If you are not familiar with Pivot Tables, I cannot stress enough
how much easier spreadsheet life becomes once you are!
If you are not already aware, the Excel COUNTIF formula/function can only check to see if
specified cells meet one condition, e.g.
COUNTIF Syntax

=countif(range,criteria)
=COUNTIF(A1:A20,">20")
Which would COUNT all numeric cells in the range A1:A20 where values were greater than 20.
Note the criteria argument is in the form of a number, expression, or text that defines which cells
will be counted. For example, criteria can be expressed as 20, "20", "=20", ">20", "North",
"N*".
=COUNTIF($A$1:$A$20,20), =COUNTIF($A$1:$A$20,">20"),
=COUNTIF($A$1:$A$20,"North"), =COUNTIF($A$1:$A$20,"N*")
Ok, so if we need to count a range of cells where corresponding cells (on the same row but
different column) meet 1, or more conditions we can no longer use the COUNTIF. The other
formulas we can use, in order of their efficiency, are
1) DCOUNT & DCOUNTADownload advanced examples of DCOUNT
2) SUM as an array formula
3) COUNT with and IF function nested and entered as anarray formula .
DCOUNT will count only numeric cells where the cells, or corresponding cells meet a specified
criteria.
DCOUNTA will count all cells (Text or numeric) where the cells, or corresponding cells meet a
specified criteria.
For all examples I will use the data as shown below. Where A2:E25 has been named: DataTable

DCOUNT
Count the numbers in a column of a list, or database, that match criteria you specify. For
example;=DCOUNT(DataTable,B2,Criteria)Would Count all cells in B2:B25 that meet the
criteria is the named range: Criteria (shown below)

The top row of the range: Criteria has exact copies of the headings in the range DataTable . The
reference to cell B2 is telling the DCOUNT to count the numbers in B2:B25 that meet the
criteria. We could replace the reference to B2 with the text "Quantity", or the number 2 as the
"Quantity" column is the second column in the table.
The criteria text "Bourbon" and "Vodka", under the criteria table heading "Description", tells
DCOUNT that either "Bourbon" OR "Vodka" is a match. The same principle is used for the
"Alcohol Content", i.e. "High" OR "Low". This is then seen by DCOUNT as an OR condition.
Note the repeat of the date under "Use By Date". This is needed when using more than 2 rows as
the criteria as a blank cell is seen as a wildcard character. If we wanted to count only data that
lies between 2 dates, we would need have 2 "Use By Date" headings in our Criteria range and

use: >7-Apr-2005 below one of these headings and <7-Jun-2005 under another. This is then seen
by DCOUNT as an AND condition.
Download advanced examples of DCOUNT
DCOUNTA
If we changed the above DCOUNT example to:
=DCOUNT(DataTable,A2,Criteria)
We would always get a result of 0 (zero) regardless of the criteria being met, or not. This is
because DCOUNT will only ever count all numeric cells and there are none in column A under
the "Description" field.
To get a count of these cells, we would need to use the DCOUNTA function which would count
all cells, text or numeric, where the criteria is being met. That is;
=DCOUNTA(DataTable,A2,Criteria)
SUM as an array formula
Normally, the SUM function will add all numeric cells in a specified range. However, when used
as an array formula with criteria used, it will give us a count instead of a sum. See below
example=SUM((A2:A25="Vodka")*(C2:C25>VALUE("7-Apr-2005"))*(E2:E25="High"))
+SUM((A2:A25="Bourbon")*(C2:C25>VALUE("7-Apr-2005"))*(E2:E25="Low"))
As with the DCOUNTA example, the above array entered (Ctrl+Shift+Enter) SUM example
would count all rows where the "Use By Date" is greater than 7-Apr-2005, the "Description" is
either "Vodka" OR "Bourbon" and the "Alcohol Content" is "High" OR "Low".
The reason it gives a count is because each check is returned as TRUE (has a value of 1) or
FALSE (has a value of 0). So, in the above example, the third row check would actually look
like;=SUM((0)*(0)*(1))+SUM((1)*(1)*(1))As you can see, unless all 3 criteria are met in at
least one of the Sum functions, the result will always be 0 (FALSE). To read about this in
detail, see our April edition of our free Excel Newsletter
COUNT and IF
=COUNT(IF(A2:A25="Bourbon",IF(C2:C25>VALUE("7-Apr2005"),IF(E2:E25="Low",B2:B25))))+COUNT(IF(A2:A25="Vodka",IF(C2:C25>VALUE("7Apr-2005"),IF(E2:E25="High",B2:B25))))

The above, does the same as the array SUM example and must be entered by pushing
Ctrl+Shift+Enter. Note we have told the COUNT to count all cells in B2:B25 where the criteria
is met. In other words, count all "Quantity" cells where the rest of the specified rows of the
"Description", "Use By Date" and "Alcohol Content" meet the specified criteria
It is important to know that using the array entered COUNT and IF, or the SUM as an array
formula over a large number of cells will cause a noticeable slow down in Excel's recalculation
time. The DCOUNT & DCOUNTA are far more efficient in this regard. However, as stated at
the very Start , a Pivot Table is better still when done correctly.

Count Each Item Only Once Count repeats in range one-time only.
When you have a large list of items you may wish to perform a count on them without counting
entries that appear more than once, multiple times. In other words you want to count each entry
once only. Consider the list show below, which has been sorted to easily see multiple entries.
A normal count on this list (COUNTA) would result in the names; Bill W, Dave H, Fran T ,
Frank W and Mary O being counted more that once.
The function we can use is the DCOUNTA. This is a good choice as it is by far the more
efficient and easy to modify.
DCOUNTA From the Excel Help
Syntax: DCOUNTA(database,field,criteria)
Database: is the range of cells that makes up the list or database. A database is
a list of related data in which rows of related information are records, and
columns of data are fields. The first row of the list contains labels for each
column.
Field: indicates which column is used in the function. Field can be given as
text with the column label enclosed between double quotation marks, such as
"Age" or "Yield," or as a number that represents the position of the column
within the list: 1 for the first column, 2 for the second column, and so on.
Criteria: is the range of cells that contains the conditions you specify. You can
use any range for the criteria argument, as long as it includes at least one column label and at
least one cell below the column label for specifying a condition for the column

END OF EXCEL HELP


Ok, based on the list shown above, in cell D1 enter the word Criteria (or any heading that is
NOT the same as your list heading). Below this in cell D2 enter this formula:
=COUNTIF($A$2:A2,A2)=1
Note the relative (A2) references and absolute ($A$2) references! These are vital to the
criteria working.
Now, in the cell you want your result shown enter this function
=DCOUNTA($A$1:$A$100,1,$D$1:$D$2)
This will give the the result you need!
COUNTIF & SUMPRODUCT Method
The other method we can use, slower than the DCOUNTA shown above, is a combination of
SUMPRODUCT & the COUNTIF function.
=SUMPRODUCT(($A$1:$A$100<>"")/COUNTIF($A$1:$A$100,$A$1:$A$100&""))
Array Formula Method
The Array Formula method is by far the least efficient and falls over if/when blanks occur in the
list.
=SUM(1/COUNTIF($A$1:$A$100,$A$1:$A$100))

Count Words in a Cell Unlike Microsoft Word, Excel does not give us a ready made way to
find out the number of words in a cell, or a range of cells containing text, or words. These Excel
formulas show you how.
Unlike Microsoft Word, Excel does not give us a ready made way to find out the number of
words in a cell, or a range of cells containing text, or words. However, with the help of the
SUBSTITUTE function/formula and the LEN function/formula we can. If you are not familiar
with these functions/formulas I have written an explanation below.
SUBSTITUTE

Syntax
=substitute(text,old_text,new_text,instance_num)
What it does
Substitutes new_text for old_text in a text string. Use SUBSTITUTE when you want to replace
specific text in a text string; use REPLACE when you want to replace any text that occurs in a
specific location in a text string.
Example
=SUBSTITUTE(A1, "Sales", "Cost") If A1 had the text "Sales Data" the formula result would be
"Cost Data".
LEN
Syntax
=len(text)
What it does
LEN returns the number of characters in a text string.
Example
=LEN(A1) If A1 had the text "Sales Data" the formula result would be 10 as A1 has 9 text
characters and 1 space character.
Count Words in a Cell
The formula below will return the number of words (not characters) in cell A1
=LEN(A1)-LEN(SUBSTITUTE(A1," ",""))+1
Be aware that superfluous spaces are also counted and may give misleading results. To ensure
accuracy we can simply nest the TRIM formula function/formula in the first LEN
=LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1
Count Words in a Range of Cells
The formula below will return the number of words (not characters) in cells A1:A5
=LEN(TRIM(A1&A2&A3&A4&A5))-LEN(SUBSTITUTE(A1&A2&A3&A4&A5," ",""))+5
Or

=LEN(TRIM(A1&A2&A3&A4&A5))-LEN(SUBSTITUTE(A1&A2&A3&A4&A5," ",""))
+Rows(A1:A5)
Keep in kind that the formula above WILL return 1 for an empty cell, due to +1. Overcome
that problem by use of this function;
=LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+(LEN(A1)>1)
The +(LEN(A1)>1) will either return TRUE (1) or FALSE (0).

Count of Each Item in a List With the aid of Advanced Filter and the COUNTIF we can get a
count of each item that appears in a list.
With the aid of Advanced Filter and the COUNTIF we can get a count of each item that
appears in a list. Let's say the list currently resides in A1:A100, with A1 being a heading and
many items appearing more than once. We first need to create ourselves a list which has only one
occurrence of each item.
Create a Unique Item List
1) Select A1:A100 and then go to Data>Filter>Advanced Filter
2) Ensure "Action" is set to Copy list to another location
3) "List Range" is $A$1:$A$100 and "Criteria Range" is blank.
4) "Copy to" is $F$1 (or any single cell in row 1).
5) Check the "Unique records only" checkbox and then click "Ok".

Now, Starting from F1 (or the cell you chose), you have a list containing only one occurrence of
each item in the list.
Enter the COUNTIF Formula
Now we have the unique list, we can now count how many times each item appears in our
original list in A1:A100. So in F2 (F1 is a heading and can read "Count") enter the COUNTIF
Formula as shown below
=COUNTIF($A$2:$A$100,$F2)
Now click the Fill Handle of F2 while it's selected, or copy down manually. Note the use of the
absolute range $A$2:$A$100 and the absolute column and relative row of $F2.

Count Between Date Ranges


To count dates that fall between a date range we can use SUMPRODUCT with a
twist. Suppose you have a list of valid dates in A1:A20. The formula we can use to
count dates that fall between 2 dates is;
=SUMPRODUCT(($A$1:$A$20>D1)*($A$1:$A$20<E1))
Where D1 houses your start date and E1 you end date.
Or, we can hard code the dates into our SUMPRODUCT Function by using the DATE
Function.
=SUMPRODUCT(($A$1:$A$20>DATE(2010,7,29))*($A$1:$A$20<DATE(2010,
8,1)))
Syntax for the date function is: DATE(Year, Month, Day)

VLOOKUP Perhaps one of Excels most commonly used Excel Formulas is the VLOOKUP. It is
also possibly the Excel formula that most people have problems understanding.

Excel VLOOKUP Formula Explained OR Show Me Visually


Perhaps one of Excels most commonly needed Functions is the VLOOKUP. It is also possibly
the function that most people have problems understanding. The Excel VLOOKUP function is
used to look for specified data in the first column of a table of data. Once found it will return a
result, on the same row, a specified number of columns from the first column. The syntax for
VLOOKUP is:
=vlookup(lookup_value,table_array,col_index_num,range_lookup)

It is used in the following manner:


=VLOOKUP("Dog",$A$1:$E$1000,3,False)
Note the use of False as the optional range_lookup Argument. This tells the VLOOKUP to find
an exact match and is most often needed when looking for a text match. If this is omitted, or
True, you will often get unwanted results when searching for text that is in an unsorted column
of data. This means that when True is used, or the range_lookup Argument is omitted, your data
should be sorted (by the first column) in ascending order.
The use of True, or range_lookup Argument is omitted, is most often used when looking at
numeric data that resides in the first column of your table of data.

1
2
3
4
5
6
7
8
9
1
0

A
B
Amoun
t
Name
$256.95 Bill
$125.63 Joe
$25.66 Mary
$548.00 Dave
$489.32 Frank
$500.25 Sue
$368.59 Hillary
$901.56 Kate
$99.95 Aleisha

C
Age
56
22
59
21
48
19
15
25
33

If we were to use:
=VLOOKUP(368.59,$A$1:$C$10,2)
on the above data, we would get a result of "Mary" and NOT "Hillary" as we have omitted the
range_lookup Argument AND our data is not sorted by Amount. This is because VLOOKUP
looks in Column A, Starting from A1, and as soon as it encounters the amount $548.00 it drops
back to the cell above because $548.00 is greater than the lookup_value of 368.59
If we sorted our data by Amount we would get the desired result. We could also get the desired
result by using:
=VLOOKUP(368.59,$A$1:$C$10,2,False)
The use of False as the range_lookup Argument forces VLOOKUP to search all values and only
stop when it finds an exact match. If an exact match does not exist we get the #N/A! error.

The method of sorting is best as a VLOOKUP that searches in a sorted range is MUCH faster.
The effect of this can be significant if the table is large and/or you have many VLOOKUP
functions.
How to stop the #N/A! error | Excel Video Tutorials

Stop #N/A! In Vlookup

Stop The #N/A! Error in VLOOKUP


The single best and most efficient way is to do this is;

1) Add your lookup formula to a spare column (e.g Column "A") and allow the #N/A! to happen.
2) Now reference these cells from the required cells like this;
=IF(ISNA(A1),0,A1)
3) Hide Column "A" by selecting it and going to Format>Column>Hide
The second most efficient is probably like this;

Instead of;
=VLOOKUP("Dog",A1:D100,2,False)
Use;
=IF(COUNTIF(A1:A100,"Dog"),VLOOKUP("Dog",A1:D100,2,FALSE),0)
The least efficient method is like;

=IF(ISNA(VLOOKUP("Dog",A1:D100,2,FALSE)),0,VLOOKUP("Dog",A1:D100,2,FALSE))
If you don't like the Zeros showing you can hide them via Tools>Options>View - Zero values.
Or, cell-by-cell with a Custom Format like: General;-General;

Excel HLOOKUP Another one of Excels most commonly needed Excel Formulas is the
HLOOKUP.

Excel Hlookup formula-function explained


The Excel Hlookup formula is perhaps one of the most used formula used when looking up data
set up in a table.
Want to learn the Excel Hlookup formula and other Excel Formulas?
The Excel Hlookup Formula Explained

Perhaps one of Excels most commonly needed Functions is the Hlookup.


The Excel Hlookup function is used to look for specified data in the first row of a table of data.
Once found it will return a result, from the same column, a specified number of rows down from
the first row. The syntax for Hlookup is:
=Hlookup(lookup_value,table_array,row_index_num,range_lookup)
It is used in the following manner:
=Hlookup("Dog",$A$1:$E$1000,3,False)
Note the use of False as the optional range_lookup Argument. This tells the Hlookup to find an
exact match and is most often needed when looking for a text match. If this is omitted, or True,
you will may get unwanted results when searching for text that is in an unsorted row of data.
This means that when True is used, or the range_lookup Argument is omitted, your data should
be sorted (by the first row) in ascending order.
The use of True, or range_lookup Argument is omitted, is most often used when looking at
numeric data that resides in the first row of your table of data.
HLOOKUP Example

Amou
nt

Name

Age

$256.
Bill
95

56

$125.
Joe
63

22

$25.6
Mary
6

59

$548.
Dave
00

21

$489.
Frank
32

48

$500.
Sue
25

19

$368.
Hillary
59

15

$901.
Kate
56

25

1 $99.9
Aleisha
0
5

33

If we were to use:
=HLOOKUP("Name",$A$1:$C$10,2,False)
The use of False as the range_lookup Argument forces Hlookup to search all values on row 1
and only stop when it finds an exact match. If an exact match does not exist we get the #N/A!
error.
How to stop the #N/A! error when using Hlookup
One very common question asked by Excel users is "How can I stop Hlookup returning #N/A!
when it cannot find my data?". There are a few ways this can be done, unfortunately the most
popular way is also the least efficient. This is to use the ISNA function as shown below:
=IF(ISNA(Hlookup("Accounts",$A$1:$F$1000,2,False)),"",Hlookup("Accounts",
$A$1:$F$1000,2,False))
The use of the ISNA function like this will force Excel to perform the Hlookup twice if the value
does exist, which is most often the case. This can become a problem by slowing down Excel's
recalculation time. A slightly better options is:
=IF(COUNTIF($A$1:$F$1,"Accounts"),Hlookup("Accounts",$A$1:$F$10000,2,False),"")

Left Lookup in Excel Excel is very rich in Lookup formulas, with perhaps the VLOOKUP
being the most popular. However, the draw-back with all Excel's Lookup formulas is that they

will only look in the left most column and return the result from the corresponding cell to the
right. There are times when users need to lookup data in any column of table and return the
corresponding cell to the left.
Excel is very rich in Lookup formulas, with perhaps the VLOOKUP being the most popular.
However, the draw-back with all Excel's Lookup formulas is that they will only look in the left
most column and return the result from the corresponding cell to the right. There are times
when users need to lookup data in any column of a table and return the corresponding cell to the
left. To do so, we can use the INDEX & MATCH Formula/Functions
INDEX & MATCH
The INDEX Formula/Function has 2 versions available. We will only be using the first version
here;
1) INDEX Formula/Function. Returns the value of a specified cell or array of cells within array.
Syntax
INDEX(array,row_num,column_num)
2) INDEX Formula/Function. Returns a reference to specified cells within reference.
Syntax
INDEX(reference,row_num,column_num,area_num)
The MATCH Formula/Function Returns the relative position of an item in an array that matches
a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions
when you need the position of an item in a range instead of the item itself.
Syntax
MATCH(lookup_value,lookup_array,match_type)
See Excels help for full details on these 2 Formula/Functions.
Left Lookup
To do a left lookup we can use the INDEX Function/Formula with the MATCH
Function/Formula nested in the Row_num Argument of the INDEX Function/Formula. Let's say
our table of data resides in a table named DataTable and this named range refers to: $A$1:$D$9
See Image below;

As you can see, the first example uses the formula:


=INDEX(DataTable,MATCH("RKP4",ID,0),1) and makes use of the Named ranges. The
second does exactly the same, but does not use the Named ranges, i.e.
=INDEX($A$1:$D$9,MATCH("RKP4",$C$1:$C$9,0),1)
In Laymen's terms, the formula is telling Excel to use the range $A$1:$D$9 as the array
Argument, row 4 for the row_num Argument (returned via the MATCH Formula/Function) and
Column 1 of the array $A$1:$D$9. Which returns the data in cell A5 (Mary K).
Returning the Column Number and Row NumberWe can either take this a step further and
ensure the column_num argument supplied is always correct by nesting another MATCH
Formula/Function into the column_num argument. The formula for this would be;
=INDEX(DataTable,MATCH("RKP4",ID,0),MATCH("Name",Headings,0))
OR, with no Named Ranges
=INDEX($A$1:$D$9,MATCH("RKP4",$C$1:$C$9,0),MATCH("Names",$A$1:$D$1,0))With
both the above examples, we can assure that moving the Names Column will not cause our
formula to return an incorrect result.

Excel Lookups With Array Constants Would like to show you what I call: In-Cell-Lookups.
These are the perfect replacement for multiple nested IF functions.

Lookups With Array Constants


Would like to show you what I call: In-Cell-Lookups. These are the perfect replacement for
multiple nested IF functions.
Enter 1 in cell A1
Select A1 and while holding down the Ctrl key and drag down by the Fill Handle until you reach
Cell A20.
Now, in B1 add this formula;
=LOOKUP(A1,{1,6,11,16},{"1-5","6-10","11-15","16-20"})

and double click the Fill Handle so this formula is copied down to B20.
As you can see, this returns a text result of the numeric scope our numbers fall into.
Here's the details of how this works. Text quoted from Excel help
SYNTAX:=LOOKUP(lookup_value,lookup_vector,result_vector)
lookup_value: Required. A value that LOOKUP searches for in the first vector. Lookup_value
can be a number, text, a logical value, or a name or reference that refers to a value.
lookup_vector: Required. A range that contains only one row or one column. The values in
lookup_vector can be text, numbers, or logical values.
Important: The values in lookup_vector must be placed in ascending order: ...,-2, -1, 0, 1, 2, ...,
A-Z, FALSE, TRUE; otherwise, LOOKUP might not return the correct value. Uppercase and
lowercase text are equivalent.
result_vector: Required. A range that contains only one row or column. The result_vector
argument must be the same size as lookup_vector.
For both lookup_vector and Result_vector we have used what is known as Array Constants
After reading the link above you should understand "Array Constants". So, as you can see our
"lookup_vector" is placed in ascending order using the lowest value for each numeric scope. Our
"result_vector" Array Constants correspond to our "lookup_vector" Array constants.

Dynamic Formulas Rather than bog you Spreadsheet down with hundreds, if not thousands of
formulas, use a single formula with flexible and changeable Arguments. In this example I will
use the INDEX/MATCH functions nested together. You can also instruct the end formula to
return the corresponding cell, to the match, on the left or right. However, the the same principles
can apply to most Excel formulas.

Excel Dynamic Formulas


Rather than bog you Spreadsheet down with hundreds, if not thousands of formulas, use a single
formula with flexible and changeable Arguments. In this example I will use the INDEX/MATCH
functions nested together. You can also instruct the end formula to return the corresponding cell,
to the match, on the left or right. However, the the same principles can apply to most Excel
formulas.

In this example I have used the range A2:D14 as my table range. I have also made good use of
Named Ranges and Data Validation. The single formula, in this case, ends being;
=IF(ISERROR(INDEX(DataTable,MATCH(Look_For,INDIRECT(Column_To_Look),0)+1,IF(
Look_Left_Right="Right",MATCH(Column_To_Look,Heads,0)+Offset_To_Column,MATCH(C
olumn_To_Look,Heads,0)-Offset_To_Column))),"Invalid
Criteria",INDEX(DataTable,MATCH(Look_For,INDIRECT(Column_To_Look),0)+1,IF(Look_
Left_Right="Right",MATCH(Column_To_Look,Heads,0)+Offset_To_Column,MATCH(Column
_To_Look,Heads,0)-Offset_To_Column)))
Or, if don't mind see formula errors IF invalid argument criteria is used, it is simply;
=INDEX(DataTable,MATCH(Look_For,INDIRECT(Column_To_Look),0)+1,IF(Look_Left_Rig
ht="Right",MATCH(Column_To_Look,Heads,0)+Offset_To_Column,MATCH(Column_To_Loo
k,Heads,0)-Offset_To_Column))
Download Example

INDEX/MATCH Functions While the Vlookup Function is very useful, it cannot look in any
Column, only the 1st. Also, it cannot offset x columns to the left or return the value x rows
before or after the found value. An INDEX & MATCH combo will allow for all of this
flexibility.
While the Vlookup Function is very useful, it cannot look in any Column, only the 1st. Also, it
cannot offset x columns to the left or return the value x rows before or after the found value. An
INDEX & MATCH combo will allow for all of this flexibility.
SYNTAX

INDEX(array,row_num,column_num)
MATCH(lookup_value, lookup_array, [match_type])

Consider the above table and that we need to find out the "Project" corresponding to the
"Original Project Start Date" of the 4/08/2009. We would use;
=INDEX($A$1:$D$9,MATCH(DATE(2009,8,4),$B$1:$B$9,0),1) would return "Project 4".
Where the dates are in the European format of d/mm/yyyy. The 1 at the end tells INDEX to
return the cell from the 1st Column of the array $A$1:$D$9. The Match is told to return the
relative row number of the DATE(2009,8,4) in the lookup_array of $B$1:$B$9. The use of
zero (0) in the MATCH functions tells it to find and exact matching date.
Now consider we need to find the the "Project" x rows before or after the "Original Project Start
Date" of the 4/08/2009. We would use;
=INDEX($A$1:$D$9,MATCH(DATE(2009,8,4),$B$1:$B$9,0)-1,1) to return the "Project" 1
row before the "Original Project Start Date" of the 4/08/2009
=INDEX($A$1:$D$9,MATCH(DATE(2009,8,4),$B$1:$B$9,0)+1,1) to return the "Project" 1
row after the "Original Project Start Date" of the 4/08/2009

Find Nth Occurrence in Excel As you may already know, we can use VLOOKUP, or
INDEX/MATCH to locate the first occurrence of a specified value in a list, or table of data.
However, Excel has no ready made formula that allows us to locate say the second, or third
occurrence etc of a specified value.
As you may already know, we can use VLOOKUP , or INDEX/MATCH to locate the first
occurrence of a specified value in a list, or table of data. However, Excel has no ready made
formula that allows us to locate say the second, or third occurrence etc of a specified value. To
do this would normally the use of a Custom Excel VBA Function, or a horribly inefficient A
rray formula . Below you will find 2 ways to locate the nth occurrence of a specified value and
return the value on the same row but in another column. One is straight forward and requires no
VBA, while the second does make use of Excel VBA. Neither need array formulas!

Find the Nth Occurrence of Specified Value Non VBA Method.


I will use the table of data as shown below for the example, sorted only for easier reading. Note
the formula that resides in the selected cell A2 (see Formula bar) is: =B2&"
"&COUNTIF($B$2:$B2,B2) and is used to obtain a count of each occurrence. It is vital to note
the Absolute of $B$2 and the relative row reference of $B2. This is vital so when you copy the
formula down, it will extend the COUNTIF range accordingly.

Note also that this extra column can be hidden from view to make for less clutter. If you have not
already guessed, we now simply use a standard VLOOKUP, or INDEX/MATCH to obtain the
occurrence we want, for example;
=VLOOKUP("Bill 3",$A$1:$C$22,3,FALSE)
Would yield a return value of "Bill # 3"
Find the Nth Occurrence of Specified Value Custom VBA Function

The custom function/formula below was written in Excel 2003 and may not work in earlier Excel
versions.
Function Nth_Occurrence(range_look As Range, find_it As String, _
occurrence As Long, offset_row As Long, offset_col As Long)
Dim lCount As Long
Dim rFound As Range

Set rFound = range_look.Cells(1, 1)


For lCount = 1 To occurrence
Set rFound = range_look.Find(find_it, rFound, xlValues, xlWhole)
Next lCount
Nth_Occurrence = rFound.offset(offset_row, offset_col)
End Function

The custom function/formula can now be used like shown below


=Nth_Occurrence($B$1:$B$22,"Harry",3,0,1)
The syntax is
=Nth_Occurrence(range_look,find_it,occurrence,offset_row,offset_col)
Where $B$1:$B$22 (range_look) is the range to find the 3rd occurrence (occurrence) of
"Harry" (find_it). When found, it will return the value by offsetting 0 rows (offset_row) and 1
column (offset_col) to the right. The offset_row and offset_col arguments can be negative
values if that is what is needed.

Excel Lookup Table VLookup is the perfect Excel formula for numerical values contained in a
range. However if you tried to use VLookup with text in a table, it's use would be limited, For
example surnames such as Smith, Smithson, Smithy, Smithson-Jacobs would create problems.
VLookup is perfect for numerical values contained in a range. However if you tried to use
VLookup with text in a table, it's use would be limited, For example surnames such as Smith,
Smithson, Smithy, Smithson-Jacobs would create problems. If you entered a surname
incorrectly, VLookup will step back to the closest possible match.

If you wish to glean information from a table that uses text, you can use VLookups optional
fourth argument called match-type. This argument forces VLookup to return #N/A if an exact
match cannot be found in the first column of your table. This type of VLookup is perfect to glean
information from an address list.
Let's say we wanted to find out the phone number of Smithson-Jacob. We would use
=VLOOKUP(B15,A2:E11,4,FALSE). Telling Excel to lookup Smithson-Jacobs in the table
range and return the value on the same row in the fourth column. By using the optional fourth
argument, FALSE, Excel is forced to return either an exact match (as it has done) or #N/A if it
can't find an exact match. See Lookup Functions here on how to stop the #N/A in lookup
formulas.
If we wanted to find the Date of Birth from within the Table we could use
=VLOOKUP(B15,A2:E11,5,FALSE), which tells Excel to return the value in the fifth column on
the same row.

Another way that we could write the same VLookup is by referring to the Surname within the
table range like this =VLOOKUP(A6,A2:E11,5,FALSE)

Dynamic Excel Lookups These are very handy for when you lookup data but cannot be sure
which column your returned data should come from. In other words, users may have inserted a
column within the table.
Dynamic Lookups in Excel You can download a working sample from the here
These are very handy for when you lookup data but cannot be sure which column your returned
data should come from. In other words, users may have inserted a column within the table. The
VLOOKUP is about the most popular of the Lookup functions so we will use this function for
examples.

Ok, let's go with a sample using a small table of data for ease of understanding. You can
download a working sample from the here
The layout of our data are headings in row 1 from A1:D1 on a Worksheet called "Data".
Names | Department | Age | Gender | Pay Rate P/H
Directly underneath these headings is related data. For simplicity though, only down to row 8.
CREATE NAMED DYNAMIC RANGES Or here for all types of Named Ranges .
NAMING THE NEEDED RANGES
*You can, if you wish, use many more rows than A1:A19,B1:B19 etc to ensure your dynamic
named ranges will keep expanding*
1) While on the "Data" Worksheet Go to Insert>Name>Define.
2) In the "Names in Workbook:" box type: Data_Table.
3) In the "Refers to:" box type, or copy/paste;
=OFFSET(Data!$A$1,0,0,COUNTA(Data!$A$1:$A$19),COUNTA(Data!$1:$1))
4) Click Add but not OK, just yet.
5) Repeat steps 2, 3 and 4 using the names (no quotes) and formulas below.
"Names"
=OFFSET(Data!$A$1,0,0,COUNTA(Data!$A$1:$A$19),1)
"Department"
=OFFSET(Data!$B$1,0,0,COUNTA(Data!$B$1:$B$19),1)
"Age"
=OFFSET(Data!$C$1,0,0,COUNTA(Data!$C$1:$C$19),1)
"Gender"
=OFFSET(Data!$D$1,0,0,COUNTA(Data!$D$1:$D$19),1)
"Pay_Rate_PH"
=OFFSET(Data!$E$1,0,0,COUNTA(Data!$E$1:$E$19),1)
"Headings"
=OFFSET(Data!$A$1,0,0,1,COUNTA(Data!$1:$1))

6) Now after clicking Add for the last named range, click OK.
It is vital that there is no other data on the "Data" Worksheet other than your table of data
occupying A1:E8.
Let's now show some formulas that can be used to lookup a name in the table (Data_Table) and
return the "Department" they work in.
VLOOKUP WITH COLUMN()
=VLOOKUP("June K",Data_Table,COLUMN(Department),FALSE)
This formula will locate the name "June K" in the 1st column of data (Names) and return the
corresponding row from the "Department" column. Should a user insert a column anywhere
within, or at the end of the table, the formula will still return the correct result. However, should
a column be added before Column A (making "Names" become column B) it will fail. To address
this potential problem we could use Index with Match .
INDEX WITH MATCH
=INDEX(Data_Table,MATCH("June K",Names,0),MATCH("Department",Headings,0))
This formula is the most flexible as not only will it accommodate columns being added
anywhere within, before or after the table, we can also use it to look left of our Names column.
This may be needed when/if a column is added to the Start of our table.
VLOOKUP WITH MATCH
=VLOOKUP("June K",Data_Table,MATCH("Department",Headings,0))
Again though, as it uses VLOOKUP it will always look in the first column only of the table
(Data_Table) for the name.
INTERSECTION
=June_K Department
This last one requires us to add some more named ranges, but we can do so with the aid of Excel.
1) Select the table of data but do not include any headings.
2) Go to Insert>Name>Create and ensure that ONLY "Left column" is checked and click OK.
Ok, we have now created a named range for all our names. It should be noted that, as spaces are

not allowed, Excel would replace any spaces with the underscore. That is "June K" would be
named "June_K".
Now we can simply Enter the Intersection formula as shown below into any cell and it will
return the Department (or any other column) of the persons name we use. In this case it's "June
K". It is vital to note that there IS a space between "June_K" and "Department"
=June_K Department

Lookup & Return Corresponding Result While we can use any of the links above for lookup
formulas, all require a table of cells in a Worksheet. If you only have small number of items to
return based on the value of another cell, we can do the lookup without leaving the cell!
Lookup With Cell
While we can use any of the links above for lookup formulas, all require a table of cells in a
Worksheet. If you only have small number of items to return based on the value of another cell,
we can do the lookup without leaving the cell!
Choose & Match
The formulas we can use to perform the lookup within the cell is the CHOOSE function, nested
with the MATCH function. See Excel help if unfamiliar we these functions. Ok, let's assume you
have a changing value in A1 and depending on that value we wish to return a result to B1. For
example, keeping it simple, we have a Validation List that a user can choose from any one of
these Cat, Dog, Mouse, Horse or Rabbit. Based on their choice we wish to show a different result
in B1. In B1 Enter this formula;
=CHOOSE(MATCH(A1,{"Cat","Dog","Mouse","Horse","Rabbit"},0),"Cat Food","Dog
Food","Mouse Food","Horse Food","Rabbit Food")
Enter, or choose any value from Cat, Dog, Mouse, Horse or Rabbit and you will see how it
works. The use of {"Cat","Dog","Mouse","Horse","Rabbit"} in the MATCH Formula is
know as an array constant (See Excel help for details). Not be confused with Array Formulas
Keeping it Clean & Global
The main problems with the above formula is it's long, but most importantly to edit the lookup
values or the array constant, we would need to do each cell individually, or use Edit>Replace, if
possible. This is where we can Range Names , or specifically Named Constants . However,
when done, we can no longer use the CHOOSE Function. We use the INDEX Function instead.
1) Go Insert>Name>Define and type Pet in Names in workbook

2) In Refers to: type ={"Cat","Dog","Mouse","Horse","Rabbit"} and click Add


3) Type PetFood in Names in workbook
4) In Refers to: type ={"Cat Food","Dog Food","Mouse Food","Horse Food","Rabbit Food"}
and click Add then Cancel.
Now, in the cell use
=INDEX(PetFood,MATCH(A1,Pet,0))
When/if we need to edit the named constants PetFood or Pet, we can do so in one location and
our result will flow through the entire Workbook.
Lookup Scale
In the above examples we have used text values. However, it is often needed that we need to
lookup numbers that match a scale. That is, all results between 0 and 99.99 should return one
result, while those between 100 and 199.99 another and so on... Let's say we need to match the
sales amount by person to know what percentage their commission is.
1) Go Insert>Name>Define and type Commission in Names in workbook
2) In Refers to: type ={0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1} and click Add
3) Type Sales in Names in workbook
4) In Refers to: type ={0,100,200,300,400,500,600,700,800,900,1000} and click Add then
Cancel.
Now, in the cell use
=INDEX(Commission,MATCH(A1,Sales,1))
This will return a % between 0 and 100, based on the value in A1.

Sales $

%
Commissio
n

0-99.99

0%

100199.99

10%

200299.99

20%

300399.99

30%

400499.99

40%

500599.99

50%

600699.99

60%

700799.99

70%

800899.99

80%

900+999.9
90%
9
1000+

100%

It is important to note that both array constants (in the Refers to) are in Ascending order and we
have use 1 for the optional Match_type argument for the MATCH Function. You can use
Descending order, in which case Match_type must be -1

Excel Hyperlinks How to get the most from hyperlinks. Hyperlinks that still work when a
Worksheet name changes. Create a hyperlink to a Chart Sheet
Hyperlinks provide us with a convenient way to jump to a specific cell, worksheet, workbook,
another program on your hard drive, a network, an intranet or the internet. We can give our
hyperlinks meaningful names, and provide a screen tip available when the mouse is hovered over
them.
TO CREATE A HYPERLINK TO AN EXISTING FILE OR WEB PAGE
The easiest way to do this is to right click on the cell in which you wish to place your hyperlink,
then select Hyperlink from the shortcut menu.
Under Link to: in the dialog select Existing File or Web Page. Once you do this, there are a few
options you can choose.
Current Folder
If you want to select a file from the current folder, use this option and click the file you want to

link to.
Browsed Pages
If you want to select a web page, use this option to select from a list of web pages you have
browsed.
Recent Files
If you want to link to a recently used file, use this option.
Address
You can paste the address of the file you wish to link to in this area.
Finally, you can type the text you wish to display in the Text to Display option, and if you wish
you can add a screen tip that can be seen when the mouse is hovered over the hyperlink.
CREATE A HYPERLINK TO A SPECIFIC PLACE ON A WEB PAGE
To hyperlink to a specific point in a webpage, you must first bookmark the location you wish to
hyperlink to.
You can then make a selection from Current Folder, Browsed Pages, Recent Files, type in the
address in the Address: area or select the web page by opening your browser and searching for
the web page you want to link to. Once found, switch back to Excel without closing down your
browser.
Click Bookmark, then double click the bookmark you want to use.
TO CREATE A HYPERLINK TO A PLACE IN A WORKBOOK
If you wish to link to another location in your current workbook, or another workbook, you can
use a cell reference to do this. You can also use a named range , but you must ensure that the
cells are named in the destination workbook.
Again right click on your text or graphic you wish to represent the hyperlink, then select
Hyperlink from the shortcut menu.
There are two options you can select:

Place in this Document: Use this option to link to a location in the current workbook.
Existing File or Web Page: To link to a location in another workbook, choose Existing File or
Web Page. Once you have located the workbook you with to link to, select the Bookmark button
and in the list under Cell Reference, select the sheet you wish to link to, and in the Type in the
cell reference box, enter in the cell reference number. Click OK. If you have given your cells a
defined name, then in the list under Defined Names, click the name of the range you wish to link
to and click OK.
If you use this option, it is better to use a defined name to link to another Worksheet. If you do
this and your worksheet name changes, your hyperlinks will be unaffected.
CREATE A HYPERLINK TO A NEW FILE
To create a hyperlink to a new file, you must first right click on your text or graphic to be used to
represent the hyperlink.
Select Create New Document from the Link to: area of the dialog.
Under Name of new document: enter in the name of your document. The full path should be
shown under the heading Full path: If this is not the path you want, click the Change button and
select the location, then click OK.
There are two options under the When to Edit: box, make the choice to either (a) Edit the New
Document Later or (b) Edit the New Document Now.
HYPERLINK TO AN EMAIL ADDRESS
Finally, if you wish to hyperlink to a specific email address, again right click on your text or
graphic to represent your hyperlink. Then select Email address under the Link to: area of the
dialog. In the email address and Subject box, type in the recipient and the subject of your email.
* Note that some browsers and email accounts will not recognize a Subject line.
HYPERLINK TO A CHART SHEET
Unfortunately there is no standard way to link to a Chart Sheets. In fact, Excel will not let you
do this. The workaround to this is quite simple though.
1) Add a new Worksheet.

2) On the Worksheet you would like the hyperlink to the Chart sheet on, add a hyperlink to the
new Worksheet. However, the text to display should read something like: Spending Chart or
any applicable text.
3) Activate the newly added Worksheet and go to Format>Sheet>Hide
4) Right click on the hyperlink Worksheet name tab and choose View Code. In here paste the
code below and change "Spending Chart" to suite your specific text.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

If Target.TextToDisplay = "Spending Chart" Then Sheets("Spending


Chart").Select

End Sub

Hyperlink to Lookup Result Excel is quite rich in Lookup type formulas, some of the more
popular ones are VLOOKUP , INDEX/MATCH and HLOOKUP . These all do a great job in
looking up a value we specify and then return a corresponding result. However, it's often the case
that we need to go to the row containing the found value, or its offset return.
Excel is quite rich in Lookup type formulas, some of the more popular ones are VLOOKUP ,
INDEX/MATCH and HLOOKUP . These all do a great job in looking up a value we specify and
then return a corresponding result. However, it's often the case that we need to go to the row
containing the found value, or its offset return.
Hyperlink To Found Result
What we can do to actually go to our found result is nest the CELL function with some Text
Function nested inside the Hyperlink Function .
Lets use an example table as shown below. The upper left cell is A1 and only the 1st 10 rows and
3 columns are shown to keep it simple.
Names

Age

City

Dave

21

New York

Bill

33

Washington

Frank

54

Dallas

Mary

19

San Francisco

John

50

Utah

Harry

54

Kansas

June

30

Ohio

Kate

60

California

Aleisha

55

Montana

What we are doing is looking up a name from Column A and returning any corresponding
column from the found row in Column A. Before we get to the lookup part though we need to
return the Workbook and Worksheet name in the format needed for the Hyperlink function. For
example [Book1.xls]Sheet1!
As mentioned above, we use the CELL Function with some Text Functions to parse out only the
bits we need. As the CELL Function is a Volatile Function it pays to create only 1 instance of the
needed Formula and re-use as many times as needed. A Named Formula is ideal for this.
1. Activate the Worksheet the data table resides on.
2. Go to Insert>Name>Define or Formulas>Name Manager - New in 2007.
3. Use the name WbSheet and have it refer to: =MID(CELL("filename",
$A$1),FIND("[",CELL("filename",$A$1)),256)&"!"
4. OK that and back to Excel.
You can see what this will do by simply typing =WbSheet into any cell.
As we are going to be looking up a name from our data table it would also pay to create a
Validation list based off the names in Column A (optional). Let's say the name will be chosen
from, or typed in K1.
In any spare cell Enter the formula as shown below
=HYPERLINK(WbSheet & ADDRESS(MATCH($K$1,$A$1:$A$2000,0),1),$K$1 & "s'
Info")
Note the underlined 1 this what determines the relative Column in our table to which we go
when clicking the Hyperlink. This can of course also be variable by simply entering the number
in another cell, that is
=HYPERLINK(WbSheet & ADDRESS(MATCH($K$1,$A$1:$A$2000,0),$K$2),$K$1 &
"s' Info")

Or, if the column order may change, we can again (optional) use a Validation list to specify the
Column heading and then use the MATCH function to return its relative position. In the case
below I have again used $K$2 to return the column heading needed.
=HYPERLINK(WbSheet &
ADDRESS(MATCH($K$1,$A$1:$A$2000,0),MATCH($K$2,$A$1:$J$1,0)),$K$1 & "s'
Info")

Dynamic Reports Here you can see how we can the Database functions to produce dynamic
reporting 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. However, for most users there are over-whelming and give too much detail.
Alternative Report

The Database Functions is Excel combined with Data Validation and some outside the box
thinking, is another easy way to get reports on your table data. We use Data Validation to refer to
a Named Range list of Operators like =, >, >=, <, <=
Ok, lets name our table of data, including headings, Table on a sheet named Report. Next add
new sheet and name it Criteria. In A1 of this new sheet Enter: =Report!A9 (Where A9 is the left
most heading of your table) and in B1 Enter: =A1. In C1 of new sheet Enter: =Report!B9
(Where B9 is the 2nd heading of your table) and in D1 Enter: =C1. Follow this patter for all your
table headings so you result in 2 copies of each heading.
In A2 Enter: =IF(Report!$E$3=A1,Report!$A$3&Report!$B$3,"") and in B2 Enter:
=IF(AND(Report!$E$3=B1,Report!$C$3<>1),Report!$C$3&Report!$D$3,""). Now select
A2:B2 and drag via the Fill Handle to have the formulae under each duplicate heading. In any
cell Enter: =IF(OR(Report!$C$3="",Report!$D$3=""),0,1) and name this cell ColCount. Next
create a list of Operators like =, >, >=, <, <= in 1 Column. Name this range Operators. Finally
Enter: =ADDRESS(1,MATCH(Field,A1:J1,0),,,"Criteria") & ":" &
ADDRESS(2,MATCH(Field,$A$1:$J$1,0)+ColCount) in a cell and Name this cell
CriteriaCell. This sheet can be hidden once you have it set-up and working.
Activate the Data sheet and starting in A2 Enter Operator 1, Criteria 1, 2nd Operator
Optional, Criteria 2 Optional, Column Where E2 ends the list with text "Column". Select E3
and Name it Field. Select A2, hold down Ctrl and select C2. Go to Data>Validation and choose
List from the Allow: box and in the Source: box add: =Operators. Select E2 and go to
Data>Validation choose List from the Allow: box and in the Source: box add: =$A$9:$E$9

where this range represents your table headings. Now starting in A5 Enter SUM, Number
COUNT, All Count, Product, Min, Max, Average across to G5.
Now the formulae going across, starting in E6, directly underneath their headings Enter;
1. =DSUM(Table,Field,INDIRECT(CriteriaCell))
2. =DCOUNT(Table,Field,INDIRECT(CriteriaCell))
3. =DCOUNTA(Table,Field,INDIRECT(CriteriaCell))
4. =DPRODUCT(Table,Field,INDIRECT(CriteriaCell))
5. =DMIN(Table,Field,INDIRECT(CriteriaCell))
6. =DMAX(Table,Field,INDIRECT(CriteriaCell))
7. =DAVERAGE(Table,Field,INDIRECT(CriteriaCell))
Select C3 (under the heading 2nd Operator Optional) go to Format>Conditional Formatting
and use Formula is: =AND($C$3="",$D$3<>"") and set the format of the Background to Red.
Finally, Select D3 (under the heading Criteria 2 Optional) Formula is: =AND($C$3<>"",
$D$3="") and set the format of the Background to Red. This will let us know when you have
used a second criteria without a second operator, or vice versa.
Download Working Example

Multi-Table Lookup Use the Dependent Validation Lists method to tell Excel to lookup any
chosen item in any table you tell it.
DEPENDENT LISTS WITH LOOKUP FUNCTIONS
We are going to look at how to use just ONE Vlookup Function to look in any number of named
tables/ranges. To make it user friendly we are going to use a Data Validation trick with lists and
have the 2 (or more) lists linked. That is, choosing an item from our 1st list will result in a
corresponding list showing the second. To see how to do this, see Dependent Data Valiation
Lists and even download the basic example.
1 VLOOKUP FOR MANY TABLES
Download Example

The principle we are going to use is the same as we used to link the 2 validation lists in the basic
download example. That is, we use the Indirect Function which will allow Excel to see the
content of any cell as either a range address, or, as in our case, a named range.
Our end Vlookup Function, based on the download example above, will be this;
=VLOOKUP($B$2,INDIRECT(SUBSTITUTE($A$2&2," ","_")),$C$2,FALSE)
$B$2 (Lookup_value) is the value we are going to be looking for.
INDIRECT(SUBSTITUTE($A$2&2," ","_")) (Table_array) is the named table we are going to
look for $B$2 in and in the left most column of that table. Note the use of the SUBSTITUTE
Function which substitutes any spaces with the underscore. This is because named ranges can
never have spaces in their names. Also note the use of $A$2&2 and not simply $A$2! This is
because we have already named the lists we use in the Data Validation list the same as whatever
is chosen from A2. So, when we name our tables, we use the same name as their lists, but add a 2
on the end. For example, our table for Cities has been named "Cities2".
$C$2 (Col_index_num) contains a Data Validation list with the numbers 2 and 3 (only 3
columns in example). Our Vlookup will offset (right) that many columns from the left most
column in the named table it looks in.
FALSE (Range_lookup) tells Vlookup we want an exact match (not case sensitive).
#STOP THE N/A!
As you change items in the Data Validation lists you will get #N/A! 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 #N/A! in Lookups

Nested IF Formula Limitation One limitation of Excel is that we can only nest Excel formulas
up to 7 levels. This is particularly limiting when trying to add nested IF Functions/Formulas that
require greater than 7 conditions.
One limitation of Excel is that we can only nest formulas up to 7 levels. This is particularly
limiting when trying to add nested IF Functions/Formulas that require greater than 7 conditions.
See Also: Named Formula method here
If you hit the 7 level limit, odds are that you are not using the correct method for your task. For
example, one common use of multiple nested IF Functions/Formulas is when we wish to have a
value returned based on the content of another cell. If this is your problem, then it's very likely

the use of the Vlookup formula with a lookup table will solve your problems! See screen shot
below;

If you are evaluating numbers being entered into a cell you could use the CHOOSE
Function/Formula. For example, if a user can enter a number between 1 and 10 into A1, you may
wish to have the text returned based on the number they enter. See example below
=CHOOSE(A1,"One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Te
n")
If you Enter the above formula into any cell and then enter a number between 1 and 10 into A1,
you will see exactly what it doing. The CHOOSE Function/Formula can take up to 30 arguments.

7 Nested IF Formula Limitation Workaround 2


It's quite common for users to encounter the 7 nested Functions in Excel. For those
not sure, a nested function is where we use the result of one function as the
argument for another.
If your functions are all IF Functions, then see Lookup Method . This by far the most
efficient and flexible way to get around the limit on IF functions.
Ok, so let's jump in with an example of where you may use this other method which
also gets around the limit.
Let's say you have a column of data (Column "A"). In this column there are a total of
70 different numeric cells. That is, 1 to 70 in any order.
Based on the content of each cell, we need to perform a Tax calculation by
multiplying a number by a defined constant named "Tax" based on 8 different
criteria
CRITERIA
IF A1 = 1 to 7 then 7*Tax
IF A1 = 8 to 10 then 10*Tax
IF A1 = 11 to 20 then 20*Tax

IF
IF
IF
IF
IF

A1
A1
A1
A1
A1

=
=
=
=
=

21
31
41
51
61

to
to
to
to
to

30
40
50
60
70

then
then
then
then
then

30*Tax
40*Tax
50*Tax
60*Tax
70*Tax

What need to do is make all the above criteria into 2 Named Formulas
Here is how, assuming we want the results in Column "B" relative to the row in
Column "A".
1) Select B1 and go to Insert>Name>Define.
2) Now in the "Names in Workbook" box enter: Criteria1
3) In the "Refers to" box enter:
=IF(AND(A1>0,A1<8),7*Tax,IF(AND(A1>7,A1<11),10*Tax,IF(AND(A1>10,A1
<21),20*Tax,IF(AND(A1>20,A1<31),30*Tax))))
4) Now click Add.
2) Now in the "Names in Workbook" box enter: Criteria2
3) In the "Refers to" box enter:
=iF(AND(A1>30,A1<41),40*Tax,IF(AND(A1>40,A1<51),50*Tax,IF(AND(A1>
50,A1<61),60*Tax,IF(AND(A1>60,A1<71),70*Tax))))
4) Now click Add
Now we need to add the defined constant named "Tax"
1) Now in the "Names in Workbook" box enter: Tax
2) In the "Refers to" box enter: =0.15
3) Finally click Add and then OK.
Now add numbers 1 to 70 on the Worksheet Starting from A1. Use the Fill Handle
(while holding down Ctrl) of A1 after entering number 1 into A1 and reselecting it.
All that is left now is to make use of our 2 named formulas that total 8 different
criteria. So, in B1 simply Enter:
=IF(Criteria1,Criteria1,Criteria2)
Then copy down.

Round Excel Numbers Methods and Excel Formulas for rounding numbers in Excel
Excel Rounding
Excel allows us to easily round number for viewing via Format>Cells - Number - and then
Number under Category. You can short cut this by using the Increase Decimals and Decrease
Decimals on the Format toolbar, to the right of $ % , symbols. However, as with all formatting,
the true underlying value of the cell is not changed. This matters when you add some numbers
and you get a lower result than you expect. For example, Enter 1.6 and 1.6 in 2 cells, say A1 and
A2. Now format these so no decimal places are showing and you get 2 and 2. Now add these
together like =A1+A2 and you get a result of 3, not 4. You can change this and have excel work

with all numbers as they are displayed via Tools>Options - Calculation and check Precision as
displayed. BE WARNED, that this is a one-way method and the changes to ALL your numbers
cannot be undone.
TIP. You can can automatically permanently change ALL numbers in a Workbook to their
displayed value by checking Precision as displayed and then clicking OK. Now go back
Tools>Options - Calculation and uncheck Precision as displayed
If you wish to actually change the true underlying value of number we can use one of the many
ROUND Functions.
Round Numbers
The ROUND Function will round numbers to a specified number of digits. If the number of
digits is negative, it will round to the left of the decimal point. If zero it will round to the nearest
Integer (whole number).
=ROUND(1.5,0) will result in a value of 2
=ROUND(1.4,0) will result in a value of 1
Round Numbers Up
The ROUNDUP function will round numbers up, away from zero.
=ROUNDUP(1.4,0) will result in a value of 2
Round Numbers Down
The ROUNDDOWN function will round numbers down, toward zero.
=ROUNDDOWN(1.6,0) will result in a value of 1
INT (although less flexible) can also be used. =INT(1.6) will also result in 1
Round 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 MROUND. It is not available by default, so you need to go to
Tools>Add-ins and check Analysis Toolpak.
=MROUND(22.5,10) will result in a value of 20
=MROUND(22.5,5) will result in a value of 25
Some Other Round Functions

Some of the other function that can used for rounding are;
1. CEILING
2. FLOOR
3. ODD
4. EVEN
5. TRUNC
6. DOLLAR
7. INT

Percentages in Excel A percent is a ratio of a number to 100 and is usually expressed using the
percent (%) symbol. In Excel, a number can be expressed in a few different ways and used to
calculate a percentage in Excel.
A percent is a ratio of a number to 100 and is usually expressed using the percent (%) symbol. In
Excel, a number can be expressed in a few different ways and used to calculate a percentage in
Excel.
For example, 50% stands for the ratio 50:100, or .5 to 1. The following table shows the different
ways that the decimal number .5 can be expressed for use in percentage calculations:
Numeric Value

.5

Percentage

50%

Decimal

0.50

Fraction

50/100

There is one very important rule to remember with percentages. When using a percentage, format
your cells as a percentage first and the whole number 1 is equal to 100%. For example type 50
in any cell and hit Enter. Click back on your cell and go to Format>Cells>Number and select
Percentage then click OK (or click the % icon on your Formatting toolbar). You will see that
the value of your cell has changed to 5000.00%. To get 50% simply enter a value of .5, or format
your cells as a percentage first
The logic of a percentage is amount / total = percentage. The attached workbook download
shows three different ways that a percentage can be calculated.
Download Workbook Demo

Average Excluding Zeros Excel has a built in formula/function that makes averaging a range of
cells easy. However, the Excel formula AVERAGE does not exclude zeros.
Excel has a built in formula/function that makes averaging a range of cells easy. If we assume
your numbers are in A1:A100 you would simply use the Average formula like shown below;
=AVERAGE(A1:A100)
There is however, one draw-back with this. That is, it includes cells that contain 0 (zeros). This
can give you unexpected results. While the sum of values is not effected, the count of them is.
Average is the sum of numbers divided by the count of numbers. So how do we omit zeros from
our average?
SUMPRODUCT & SUM
=SUM(A1:A100)/(SUMPRODUCT((A1:A100<>0)*1))
This method is the most generic in that it ignores blank cells and will include negative
numbers.
COUNTIF & SUM
By far the most efficient method is to use the SUM formula and COUNTIF formula as shown
below;
=SUM(A1:A100)/COUNTIF(A1:A100,">0")
This method will not work should you have negative numbers unless you change ">0" to
"<>0" The drawback is it will then count blank cells. Where as the one below wont.
=SUM(A1:A100) / (COUNT(A1:A100) - COUNTIF(A1:A100,0))
=SUMIF(A1:A100,">0")/COUNTIF(A1:A100,">0") Will also exclude negatives unless you
use "<>0". However, it will then count blank cells.
If you do have negative numbers, and no blank cells, use;
=SUM(A1:A100)/COUNTIF(A1:A100,"<>0")
DAVERAGE
The other method is via the DAVERAGE function. This function is part of the Database
functions and all are extremely useful when/if you need specify multiple criteria. The

DAVERAGE , in the case of numbers being in A2:A100 (A1 should be a heading) we could use
the DAVERAGE like below;
=DAVERAGE($A$1:$A$100,1,$B$1:$B$2)
Where "1" represents the relative column position to average in the range A1:A100
B1 has an exact copy of your heading in A1
B2 houses the expression >0
Array Average
This method is the least efficient. By creating an array formula we can use the Average formula
as shown below to omit zeros;
=AVERAGE(IF($A$1:$A$100,$A$1:$A$100))
=AVERAGE(IF($A$1:$A$100 <>0,$A$1:$A$100))
As these are array formulas they MUST be entered via Ctrl+Shift+Enter.

Minimum Excluding Zeros Excel has a built in formula/function that makes finding the
minimum value in a range of cells easy. However, the Excel formula MIN does not exclude
zeros.
Excel has a built in formula/function that makes finding the minimum value in a range of cells
easy. If we assume your numbers are in A1:A100 you would simply use the MIN formula like
shown below;
=MIN(A1:A100)
There is however, one draw-back with this. That is, it includes cells that contain 0 (zeros). This
can give you unexpected results. So how do we omit zeros from our average?
SMALL Function/Formula
By far the most efficient method is to use the SMALL and COUNTIF formula as shown below;

SMALL Returns the k-th smallest value in a data set.


=SMALL(A1:A100,COUNTIF($A$1:$A$100,0)+1)
Where the countif is counting the zeros in the range (+1) and is used to tell SMALL to return the
k-th smallest value.
DMIN
The other method is via the DMIN function. This function is part of the Database functions and
all are extremely useful when/if you need specify multiple criteria. The DMIN , in the case of
numbers being in A2:A100 (A1 should be a heading) we could use the DMIN like below;
=DMIN($A$1:$A$100,1,$B$1:$B$2)
Where "1" represents the relative column position to average in the range A1:A100
B1 has an exact copy of your heading in A1
B2 houses the expression >0 or <>0 if have negative numbers you want included.
Array MIN
This method is the least efficient. By creating an array formula we can use the MIN formula as
shown below to omit zeros;
=MIN(IF($A$1:$A$1004 >0,$A$1:$A$100))
=MIN(IF($A$1:$A$1004 <>0,$A$1:$A$100))
As these are array formulas they MUST be entered via Ctrl+Shift+Enter.
Efficient Excel Spreadsheet Design This page is a must read for anyone with the task of
designing and setting up an Excel spreadsheet. It talks about formatting, layout and calculation
speed.

Speed up Slow Calculations in Excel


Questions? Excel Help

See Also: speed up vba code & Slow Macros & Excel/VBA Golden Rules & Excel
Services Best Practices | Consider The Code-VBA Add-in To Ensure your code is
efficient Code
Intro

Excel is without doubt a very powerful spreadsheet application and arguably the best in the
world. However, 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. A good spreadsheet should have about 80% planning and 20% implementation. While
this can seem extremely inefficient in the short run, I can assure you that the long term gain will
far outweigh the short-term pain. Remember that spreadsheets are about giving correct
information to the user, not possible erroneous information that looks good. Let's look at how a
spreadsheet should be set up efficiently.
Excel Best Practice & Design On this page
Rows (Shame on Microsoft)
Formatting (The least important Aspect)
Layout (THE most important Aspect)
Formulae (This is what it is all about)
Speeding up Re-calculations (how to, do's & dont's)
Array Formulas (what so called formulae gurus Wont Tell You)
UDFs or Custom Functions (Rarely required)
Volatile Functions (Avoid these)
Lookup Functions (How to speed up)
Microsoft's Tips For Optimizing Speed (from the horses mouth)
Outside Links

1. Microsoft Knowledge Base Article - Q72622


2. Recalculation in Microsoft Excel

3. Improving Performance in Excel 2007


4. Importance of Calculation Speed
Rows [top]

The very 1st thing you SHOULD know about Excel is that ALL versions contain far more
rows than the Application can ever hope to handle. Why Microsoft continue to mislead its
users by supplying far more rows than it can handle remains a mystery. My best guess is that,
like most car speedometers, the upper range exceeds the cars capabilities.
Even with newer versions, the expectations far exceed the Applications capabilities. In fact, the
problems (misleading of its users) gets worse. For Example, Excel 2007 now has 1 million rows
and if you fill just 1 column using all rows, save a close, you will very likely never be able to
open the Workbook again. BUYER BEWARE AND DON'T FORGET ABOUT MS
ACCESS!

Spreadsheet Formatting [top]

While a spreadsheet should be easy to read and follow, this should rarely be at the expense of
efficiency. I myself am a big believer in 'keep it simple stupid' (K.I.S.S). Far too many people
spend about 30%, or more, of their time formatting their spreadsheets. This time (although they
don't realize it) often comes at the expense of efficiency and accuracy. Often the overuse of
formatting adds size to your Workbook and while it may look like a work of art to you, it may
look terrible to another. Some very good universal colors are black, white and grey.
Only ever use the cell format of Text if really necessary. This is because all data entered into the
cell becomes text and spreadsheets are all about numbers. Worse still, is any cell housing a
formula, that is referencing a Text formatted cell, will also become formatted as Text. Believe
me, you do not want formula cells to be formatted as Text! This format is VERY rarely
needed, yet frequently used.
If you apply a number format to specific cells try to not apply the format to the entire column. If
you do, Excel will assume you are using these cells. This can give unexpected results when
locating the last used cell. With 65536 (1 Million in 2007) rows in Excel it wont take too long
before you had told Excel that you are using millions of cells, when in reality the number is only
in the thousands! Having said not to format entire columns & rows, it should be noted that
intermittent & sporadic formatting to individual cells can increase file size.

If you want your formatting to automatically apply to new data, either use the "Format Painter"
(paint brush icon on the formatting toolbar). Or go to Tools>Options | Edit and check "Extend
list formats and formulas" (checked by default) this will format new items added to the end of
a list to match the format of the rest of the list. Formulas that are repeated in every row are also
copied. To be extended, formats and formulas must appear in at least three of the five last rows
preceding the new row.
Find the last used Row

See also: Excel Ranges


You can use Edit>Go to-Special-Last cell to try and find the last cell in the active sheet, but it is
not very reliable. The reasons are two-fold:
1. The last cell is only re-set when you save. This means if you enter any number or text in say,
cell A10 and A20 of a new Worksheet, then delete the content of A20, the Edit>Go to-SpecialLast cell will keep taking you to A20, until you save.
2. It picks up cell formatting. Let's say you enter any text or number in cell A10 and then enter
a valid date in cell A20 of a new Worksheet. Now delete the date in cell A20 and save. The
Edit>Go to-Special-Last cell will still take you to A20. This is because entering a date in A20
has caused Excel to automatically format the cell from "General" to a Date format. To stop
from going to A20 you will have to use Edit>Clear>All and then save.
So when using VBA you cannot rely on:
Range("A1").SpecialCells(xlCellTypeLastCell).Select

Below is a method that will find the REAL last used row
Find the last used Row on a Worksheet:
Sub FindLastRow()

Dim LastRow As Long


If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

MsgBox LastRow

End If

End Sub

Another common mistake with cell formatting is the changing of alignment of cell data. By
default, numbers are right aligned and text is left aligned, leave it this way! If you Start
changing this, you will not be able to tell at a glance if the contents of a cell is text or numeric. It
is very common for people to reference cells, that look like numbers, when in reality they are
text. If you have altered the default alignment, you will be left scratching your head. Perhaps the
exception to this rule is headings.
Merged cells are (in my opinion) to be avoided. The Microsoft Knowledge base is full of
frequently encountered problems with merged cells. As a good alternative use "Center across
selection" found on the Alignment tab of the Format cells dialog under "Horizontal".
Spreadsheet Layout [top]

When setting out you data, follow these golden rules as closely as possible.
1. Flat File database. Excel IS a flat File Application and should be used as
such.
2. Less Worksheets/Workbooks is more and makes analyzing/reporting
a LOT easier. Try and ensure all related raw data is on 1 Worksheet and in 1
workbook. The number 1 issue with excel spreadsheets is users spreading
raw data over many worksheets and/or workbooks.
3. All Layouts SHOULD contain 1 single Worksheet in a table format of RAW
DATA. From this raw data comes your FINAL data.
4. When putting in headings bold the font. This will help Excel recognize
them as headings when you use one of its functions eg; Sort.
5. When putting data into the data area of your spreadsheet try to
avoid blank rows and columns. This is because a lot of Excels built-in
features will assume a blank row or column is the end of your data. It can also
helps with a lot of Excels formulas. Having said this though, it is a good idea
to leave at least 4 blank rows above your headings (hide them if you wish),
these can then be used for keeping Totals (much better than being at the
bottom) and criteria for some of Excels built in features, eg Advanced Filters.
6. Have your data sorted whenever possible. Excel is very rich in what is
known as Lookup & Reference formulas and many of these may rely on your

data being sorted in a logical order. It will also greatly speed the calculation
process of many functions.
7. Use real dates for headings and format them appropriately. By this I
mean if you want the names of the months as headings type them in as
1/1/2001 , 1/2/2001 , 1/3/2001 etc then format them as "mmmm". This is a
very simple procedure that is all too often overlooked by many. If you have
real dates as headings life will be much easier further down the road if you
need to use them in formulas, if you don't nothing is lost.
8. Don't put in one cell what could go in more than one cell. Say you
have the names of 100 people to put into your spreadsheet, dont put their
full name in one cell. Instead, put the First name in one cell and their
surname in the next cell to the right. If you need to place them into one
single cell at a later stage, this can be done very easily - the same cannot
always be said for the reverse.
9. Place your headings across columns and your data in rows directly
underneath. Remember that Excel has far more rows than columns. Excel
expects your data to be laid out this way.

If you can stick to these guidelines you will thank yourself later as you will then easily be able to
use many of Excels powerful built in features, which often need the data laid out this way.
Spreadsheet Formulae [top]

See also: Excel Formula Errors.


This is the biggest part of any spreadsheet! Without them you really only have a document. Excel
has over 300 built in Functions (with all add-ins installed), but chances are you will only use a
handful of these.
The number one mistake made in regards to formulae in Excel is the referencing of entire
columns, this is a big mistake! This forces Excel to look through potentially thousands, if not
millions, of cells which it need not be concerned with at all. Although later versions of Excel are
getting smarter at detecting 'dirty cells'. Assume, for example you have a table of data ranging
from cell A1 down to H1000. You may decide that you want to use one or more of Excel's lookup formulas to extract the required information. As your table may be growing, as new data is
added, it is common to reference the entire table incorporating all rows. In other words, your
reference may look something like "A:H", or possibly A1:H65536. The reason this is done is so
that when new data is added to the table it will automatically be referenced in the formulas. This
is a very bad habit to form and should be avoided in most cases. This obviously poses the
problem that if you do not do this, you will be constantly needing to update your formula
references to incorporate the new data as it is added to the table.

Possibly one of the very best ways to overcome this is to familiarize yourself with the use of
dynamic named ranges. If you are not familiar with these, check them out here: Dynamic
Ranges Please note that for the purpose of being totally generic, the examples of dynamic
ranges reference entire columns, there is most likely no need for this in your own spreadsheet. I
often play it safe and reference about 300 more rows than I think I will need.
Read the text below from the Microsoft Knowledge Base

Calculate Message Remains in Status Bar If 65,536 Formula References


Microsoft Excel calculates during different events like column auto-resizing, when entering
anything in any cell, and so forth. However, Excel can only track 65,536 dependencies to unique
references for automatic calculation.
After the workbook has passed this limit, Excel no longer attempts to recalculate only changed
cells. Instead, it recalculates all cells after each change. This behaviour is by design of
Microsoft Excel.
Microsoft Excel will correctly calculate all formulas. However, the "Calculate" message in the
status bar indicates that Microsoft Excel can no longer track the formula dependencies and is
calculating every formula in the workbook after each change. If you are unsure when the last
calculation event took place and you want to be sure your formulas are up to date, simply Start a
calculation manually. To do this, press CTRL+ALT+F9 and wait until "Calculating Cells: n%"
disappears and "Calculate" returns to the status bar.
Spreadsheet Speeding up Re-calculations [top]

A common problem with poorly designed spreadsheets is that they become painfully slow in
recalculating. Many people will suggest that a solution to this problem is putting a calculation
into Manual via Tools>Options>Calculations. This is generally very poor advice and fraught
with potential disasters. A spreadsheet is all about formulas and calculations and the results that
they produce. If you are running a spreadsheet in manual calculation mode, sooner or later you
will read some information off your spreadsheet which will not have been updated. In other
words your formulas may well be returning old values and not the updated values. This is
because when you go into manual calculation you must force Excel to recalculate by pushing the
F9 key. As you can imagine, it is very easy to overlook doing this. I liken it to a case where your
car brakes are rubbing and slowing down you car. Rather than fix the problem you disconnect the
brakes and rely on the handbrake. Most of us wouldn't dream of doing this, but most don't
hesitate to put their spreadsheet into manual calculation. The bottom line here is, if you need to
run your spreadsheet in manual calculation, you have a design problem. Address it properly and
do not apply a 'band-aid' approach.

Below is a list of what is often the worst offenders for slowing down recalculations of
spreadsheets.
1. Array formulas
2. Sumproduct used for multiple condition summing or counting
3. UDFs (User-defined functions)
4. Volatile functions
5. Lookup Functions

Let's look at each of these now in turn, and see what alternatives we can have for them.
Spreadsheet Array Formulas [top]

A possible alternative for array formulas, are Excel's database functions . 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. Another alternative which is too often overlooked is
the use of Excel's Pivot table feature. While these may seem very daunting when first
encountered, I highly recommend that you familiarize yourself with this powerful Excel feature
as once you master them, you will wonder how you survived without them!
Perhaps the biggest problem with array formulae is that they look efficient, but when compared
to an alternative, nothing could be further from the truth! An array formulae must follow rules
that Excels built in Functions do not have to, that is they must loop through each and every cell
they reference (one at a time) and check them off against a criteria. For this reason arrays are
best suited to being used on single cells or referencing only small ranges.
Spreadsheet UDFs or Custom Functions [top]

UDFs for those of you that are not aware, are User-defined Functions that are written with Excel
VBA which can then be used in a Worksheet in the same way as any one of Excel's built-in
worksheet functions. Unfortunately, no matter how good the person is at VBA who has written
the UDF, it is very unlikely that it will perform at the same speed as one of Excel's built-in
functions, even if it would be necessary to use several nested functions to get the same result.
Often a well written and efficient UDF function will incorporate the use of Excel's worksheet
functions. By this, I mean you may decide to write a UDF to replace a function which otherwise
would require you to use several worksheet functions nested within each other. The most
efficient way to replace the use of several nested worksheet functions (if you must) would be to
write a UDF that would incorporate the use of all of the worksheet functions necessary. This
way instead of having to repeatedly nest the functions on the Worksheet to get the desired result,

you could nest the functions once within VBA (by accessing the WorksheetFunction Object)
which would then allow you to use this function in the interface, without the need to repeat the
nesting. Most of Excels Worksheet Functions can be used in VBA simply by using:
WorksheetFunction.<Function Name> or Application.<Function Name> if the one you need
is not available, there will be VB equivalent.
Spreadsheet Volatile Functions [top]

Volatile functions are simple functions that will recalculate each time a change of data occurs in
any cell on any worksheet. Most functions (non Volatile) will only recalculate if a cell that they
are referencing has changed. Some of the most common volatile functions used are undoubtedly
the NOW() and TODAY() functions, there are also OFFSET(), CELL(), INDIRECT(),
ROWS(), COLUMNS() to name a few more. If you are going to be using the result of these
functions frequently throughout your spreadsheet, avoid the temptation of nesting these functions
within other functions to get your desired result (especially array formulae and UDF's). Instead,
simply type the volatile function into a single cell on your spreadsheet and reference that cell
from within other functions. This alone can potentially cut down on the amount of volatile
functions by hundreds, if not thousands.
Spreadsheet Lookup Functions [top]

Excel is very rich in Lookup & Reference Formulae, with the most popular probably being
VLOOKUP. These functions are all very generic and can be used to extract data from just about
any table of data. The biggest mistake made by most, is the forcing of Excel to look in thousands,
if not millions of cells superfluously, see: Formulae . As shown by the Formulae link, one of the
best ways to overcome this is via the use of Dynamic Ranges .
The other mistake is that the lookup functions (in the case of VLOOKUP, HLOOKUP and
MATCH) are told to find an exact match. That is, the optional fourth argument Range_lookup is
set to False in both VLOOKUP and HLOOKUP. In the case of MATCH the last optional
argument (Match_type) is set to 0 (zero). This means that Excel will need to check all cells until
it finds an exact match. If possible, always use True (or omitted) for VLOOKUP and HLOOKUP,
or 1 (sort ascending) or -1 (sort descending) in the case of Match. So, whenever possible, sort
your data appropriately. Sorting the lookup columns is the single best way to speed up lookup
functions.
Another very bad mistake is the double use of the Lookup Function nested within one of Excels
Information functions. see example below
=IF(ISNA(VLOOKUP(100,MyRange,2,False)),"",VLOOKUP(100,MyRange,2,False))

This is used to prevent the #N/A when no match can be found. The big problem with this is, it
forces Excel to use the VLOOKUP twice! As you can imagine, this doubles the number of
Lookup functions used. The best approach (if possible) is to live with the #N/A, or hide it via
Conditional Formatting . Or, if this is not an option, place the Lookup in a 'out-the-way' spot on
the same Worksheet (eg IV1) and then use:IV1=VLOOKUP(100,MyRange,2,False) Result Cell
= IF(ISNA(IV1),"",IV1). This halves the number of Lookup functions needed!
One other common problem is storing the Lookup Function on another sheet to the Table. While
the effect of this is not too bad on approximate matches, it can be dramatic on exact matches.
Consider placing the Lookup functions on the same Worksheet as the Table, then create a simply
reference (eg =Sheet1!IV1) to the cell(s) to get the result into the needed Worksheet. Doing this
also opens up another opportunity in that we could now use:
IF(ISNA(Sheet1!IV1),"",Sheet1!IV1)
Last, but far from least, learn how to use Excels Database functions . They are very easy to use
and are often much faster than their Lookup & Reference counterpart.
Microsoft's Tips For Optimizing Speed [top]

In Microsoft Excel, recalculation performance is affected by the way data and formulas are
arranged on the worksheet. The following list contains tips for optimizing your worksheet to
improve recalculation speed:

Organize your worksheets vertically. Use only one or two screens of columns,
but as many rows as possible. A strict vertical scheme promotes a clearer
flow of calculation.

When possible, a formula should refer only to the cells above it. As a result,
your calculations should proceed strictly downward, from raw data at the top
to final calculations at the bottom.

If your formulas require a large amount of raw data, you might want to move
the data to a separate worksheet and link the data to the sheet containing
the formulas.

Formulas should be as simple as possible to prevent any unnecessary


calculations. If you use constants in a formula, calculate the constants before
entering them into the formula, rather than having Microsoft Excel calculate
them during each recalculation cycle.

Reduce, or eliminate, the use of data tables in your spreadsheet or set data
table calculation to manual.

If you only need a few cells to be recalculated, replace the equal signs (=) of
the cells you want to be recalculated. This is only an improvement if you are
calculating a very small percentage of the formulas on your worksheet.

When a certain group of formulas must be recalculated a great number of


times, then it may be helpful to replace the equal sign (=) in the formulas
that you do not need to recalculate with a unique string that does not appear
elsewhere. The formulas without the equal signs will not be recalculated (they
are no longer considered formulas). When Microsoft Excel has recalculated
the formulas that still contain equal signs, search for the unique string and
restore the =.

1. Microsoft Knowledge Base Article - Q72622


2. Recalculation in Microsoft Excel
3. Improving Performance in Excel 2007

Excel Tips and Tricks This page consists of many tips and tricks you can use in Excel, from
shortcut keys to working with formulas and functions. If you know of a good one, please let us
know!
Handy Hints For Spreadsheets Here you will find out how to use Excels Conditional
Formatting and Data Validation. It explains in detail how you can use these great Excel features
to work with duplications in your spreadsheets. Best of all it shows how they can be used to
prevent them!
Data Validation for Duplicates in Excel and Conditional Formatting for Duplicates in Excel
Since Excel 97 Excel has some very handy built in features that are ideal for spreadsheets. All
that is needed is a bit of imagination and know how and these can be adopted to make life just
that bit easier. The examples below make use of Data Validation and Conditional Formatting
to both find duplicates in Excel and prevent them. If you do a lot of duplication
hunting/managing in Excel see our Excel Duplicates Manager Excel Add-in.
Validation For Duplicates
Go here if you are not familiar with Data Validation
Validation can be found by going to Data>Validation on the Toolbar. The main purpose of this
function is to set up restrictions so users can only enter data that meet the criteria that you set, but
as you will also see it can be used in other ways. For the purpose of all examples we will
assume the range of cells that users will be entering data in is A1:H10.
*IMPORTANT* Validation does not prevent users from deleting or pasting.

Preventing Duplicates in Excel


In this example we will use Validation to stop users from entering numbers or text that are
already within the range. In other words, prevent duplicates.

Click in cell A1 and holding down the left mouse button highlight down and across to cell
H10. Notice that cell A1 is the only active cell, this is for reasons I will explain in step 3.
Go to Data>Validation and you will see the "Data Validation" dialog box. From the
"Allow:" box select "Custom" and the "Formula:" box should appear.

In the "Formula" box type this formula: =COUNTIF($A$1:$H$10,A1)=1 It is important


to note the Absolute of A1:H10 with the dollar signs. The reason why we haven't
absoluted A1 is because it is the active cell and leaving it as a relative reference will let
Excel know we want B1 to have the same formula as A1 but replace A1 with B1, C1 to
have C1 etc.

Click the "Input Message" tab and type in a message that the user will see when they
select the cell. Or leave it blank.

Click the "Error Alert" tab and type a message the user will see if they type in a duplicate
entry. Now set the error level in the "Style" box to the left. To get detailed information
about this click on the "?" at the top the dialog box and then click on the "Style" box.
When you are happy with all your settings, click "OK".

Now try and type the same word or number in any 2 cells within the range A1:H10.
Preventing Accidental Overtyping
As you are no doubt aware it is possible to stop users from typing in cells by going to
Tools>Protection>Protect Sheet, but this can sometimes be like using a sledge hammer to push
in a thumb tac as it also locks you out of lot a other Excel features. Here is a way to stop users
from typing in cells that may contain entries like formulas etc yet still allow access to Excels
other features.
In this example we will use Validation to stop users from accidentally typing over the top of the
range A1:H10

Click in cell A1 and holding down the left mouse button highlight down and across to cell
H10.

Go to Data>Validation and you will see the "Data Validation" dialog box. From the
"Allow:" box select "Custom" and the "Formula:" box should appear.

In the "Formula" box type this formula: =""

Click the "Input Message" tab and type in a message that the user will see if they happen
to select the cell. Something like "FORMULA CELL!"

Click the "Error Alert" tab and type a message the user will see if they type in the cell.
Now set the error level from the "Style" box to the left. To get detailed information about
this click on the "?" at the top the dialog box and then click on the "Style" box. When you
are happy with all your settings, click "OK".

Now try and type in any cell within the range A1:H10 and you will receive the error message that
you set..
Creating a List of Allowed Entries
When developing Spreadsheets it is good practice to make them as user friendly as possible. One
great way to achieve this is to give the user a selection of pre-typed entries when they select the
cell(s). This is possible with Validation.

In a safe area of the Worksheet (lets say Column IV) type the word "Red" in cell IV1,
Blue in cell IV2 and Green in cell IV3. Now while cell IV3 is still selected go to
Format>Column>Hide, this will hide our list from users

Click in cell A1 and holding down the left mouse button highlight down and across to cell
H10.

Go to Data>Validation and you will see the "Data Validation" dialog box. From the
"Allow:" box select "List" and the "Source:" box should appear. Make sure the "In cell
drop down" box is checked.

In this Source box type =$IV$1:$IV$10. The reason we use the range IV1:IV10 is so that
we can add to our list if needed. The good thing is Excel wont show us all the blank cells
within our list.

Click the "Input Message" tab and type in a message that the user will see if they happen
to select the cell. Or leave it blank.

Click the "Error Alert" tab and type a message the user will see if they type an entry in
the cell that is not part of our list. Now set the error level from the "Style" box to the left.
To get detailed information about this click on the "?" at the top the dialog box and then
click on the "Style" box. When you are happy with all your settings, click "OK".

Now select any cell within our range and you will see a drop arrow, click this and you will see
the list we set. If they try and type an entry that is not part of the list they will receive the error
message you set.

Now push Ctrl+g to display the "Go to" dialog box, type IV1 in the "Reference" box then go to
Format>Column>Unhide. Type the word "Yellow" in cell IV4. Now click in any cell within
range A1:H10 and click the drop arrow and you will see that the new entry has been added to
your list.

Conditional Formatting For Duplicates in Excel


Go here if you are not familiar with Conditional Formatting
Conditional Formatting can be found by going to Format>Conditional Formatting. The
purpose of this function is very similar to "Validation" except instead of stopping or warning the
user when they enter a entry that does not meet the set criteria it formats the cell to how it's
format condition has been set. For the purpose of all examples we will assume the range of cells
that users will be entering data in is A1:H10.
Highlighting Duplicates in Excel
When you have large list or table of data you may need to go through the list to identify some or
all-duplicate entries. This can be a very time consuming and tedious task, but with Conditional
Formatting they can be identified in seconds or better still already identified. Follow the steps
below to see what I mean.

Click in cell A1 and holding down the left mouse button highlight down and across to cell
H10. Notice that cell A1 is the only active cell, this is for reasons I will explain in step 3

Go to Format>Conditional Formatting and you will see the "Conditional Formatting"


dialog box. From the box directly below "Condition 1" select "Formula is"

In this Formula box type this formula: =COUNTIF($A$1:$H$10,A1)>1 It is important


to note the Absolute of A1:H10 with the dollar signs. The reason why we haven't
absoluted A1 is because it is the active cell and leaving it as a relative reference will let
Excel know we want B1 to have the same formula as A1 but replace A1 with B1, C1 to
have C1 etc.

Click the "Format" button and then select the format you want to use on all duplicate
entries. Probably changing the Background colour on the "Patterns" tab to a nice bright
colour will do the trick.

When you are happy with the format conditions you have set click "OK". You will no
doubt notice the "Add>>" button, this will allow you to set up to 3 Conditional Formats
and I will show you an example of this next..

Now if you already have duplicates within your table or list they will all appear formatted as you
set, or if the range has no entries, try typing in 2 entries the same within your range. If you only
need one color, see Highlight Duplicates in Excel
Colour Code Highlighting Duplicates in Excel
Supposing you want separate the duplicates from the triplicates and the entries that occur more
than 3 times . This can easily be done by using Conditional Formatting.

Click in cell A1 and holding down the left mouse button highlight down and across to cell
H10. Notice that cell A1 is the only active cell, this is for reasons I will explain in step 3.

Go to Format>Conditional Formatting and you will see the "Conditional Formatting"


dialog box From the box directly below "Condition 1" select "Formula is"

In this Formula box type this formula: =COUNTIF($A$1:$H$10,A1)>3 It is important


to note the Absolute of A1:H10 with the dollar signs. The reason why we haven't
absoluted A1 is because it is the active cell and leaving it as a relative reference will let
Excel know we want B1 to have the same formula as A1 but replace A1 with B1, C1 to
have C1 etc.

Click the "Format" button and then select the format you want to use on all entries that
occur more than 3 times. Probably changing the background colour on the "Patterns" tab
to red will do the trick.

When you are happy with the format conditions you have set click "OK". Now click the
"Add>>" button and again select "Formula is" in the Formula box type this formula:
=COUNTIF($A$1:$H$10,A1) =3 Click the "Format" button again and set the format
you want, e.g. changing the background colour on the "Patterns" tab to yellow. Now click
"OK".

Click the "Add>>" button again and repeat step 5 above, but type this formula:
=COUNTIF($A$1:$H$10,A1) =2 and set the background colour on the "Patterns" tab to
blue. Now click "OK" for the last time.

Now all your entries that occur twice will appear in one format eg; blue background, all entries
that occur three times will have another format eg; yellow background and all entries that occur
more than three times will have yet another, eg; red background.
Find-Delete Duplicates in Excel with the the Duplication Manager

Excel Formulas This page will take you to lots of examples of Excels Formulas. It includes
formulas for dates, times, text and numbers. Each page also includes some formula tips and
tricks.

Excel Text Formulas


Here are a few examples of how you can use Excels Text Functions to extract parts of peoples
names from a list. The same formulas could also be used on any text, they don't have to be names
Full Name

Formula Used

Result

A2=David Hawley =LEFT(A2,FIND(" ",A2))

David

A3=Ray Goodwin =MID(A3,FIND(" ",A3,1)+1,LEN(A3))

Goodwin

A4=Graeme Dee

=LEFT(A4)&MID(A4,FIND(" ",A4)+1,1)

GD

A5=Suzanne
Greenhouse

=LEFT(A5)&MID(A5,FIND(" ",A5),LEN(A5))

S Greenhouse

A6=Fred Baker

=LEFT(A6,FIND(" ",A6))&MID(A6,FIND("
",A6)+1,1)

FredB

A7=Mary
Hardwick

=MID(A7,FIND(" ",A7,1)+1,LEN(A7)) & " " &


LEFT(A7,FIND(" ",A7))

Hardwick Mary

A8=Banana

=LEN(A8)-LEN(SUBSTITUTE(A8,"a",""))

3 i.e occurence
of "a"

Tips:
How to copy Excel formulas without the reference changing.
This can be achieved by either pressing F2 and then highlighting the formula, Copy, Enter then
paste to destination. Or doing the same in the Formula bar. However, this is not much good for
large amounts of data, so try this: Select the range of cells with Formulae, use the Ctrl key for
non-contiguous ranges. Now go to Edit>Replace and Replace = with #. Copy and paste to your
location and then simply use Edit>Replace # with =
To copy and transpose formulas without the reference changing

In cell A1 of sheet 2 put: =Sheet1!A1 now copy this down a max of 255 rows. Now with the
formulas selected go to Edit>Replace and Replace = with #. Now copy, select cell B1, go to
Edit>Paste special and choose Transpose. Delete Column "A" and with Row 1 selected go to
Edit>Replace and Replace # with =
If you paste any formulas copied from a Wepage into an Excel cell, push F2 first. This will
prevent any problems.
To make any of the Excel formula results upper case, nest the entire formula within the UPPER
Function, eg; =UPPER(LEFT(A2,FIND(" ",A2)))
If the text you are working with is not properly capitalized (eg; david hawley) then nest the entire
Excel formula within the PROPER Function, eg; =PROPER(LEFT(A2,FIND(" ",A2)))
If the text has not been spaced properly, use the Excel formula, TRIM eg;
=TRIM(LEFT(A6,FIND(" ",A6))&MID(A6,FIND(" ",A6)+1,1))
If you only need to separate the first and last names you can use the Text to Columns feature.
Before using this feature make sure the column immediately to the right of your data is empty:

Select the data you want to seperate.

Go to Data>Text to Columns...

Check the "Delimited" option button. Click "Next".

Select "Tab" or "Space". Click "Finish"

|| Excel Text Formulas | Excel Date Formulas | Excel Number Formulas ||

Date Excel Formulas


Working with dates in Excel is a common task and Excel has made the process relatively easy by
supplying a good selection of Date Functions. Below is just a very small example of what you
can do.

Number

Formula Used

Result

A10=2212200 =DATEVALUE(LEFT(A9,2)&"/"&MID(A9,3,2)&"/"&RIGHT( =22/12/20


1
A9,4))
01

A11=Septemb =CHOOSE(MATCH(A11,
er
{"January";"February";"March";"April";
"May";"June";"July";"August";"September";"October";
"November";"December"},0),1,2,3,4,5,6,7,8,9,10,11,12)
ie; what month is September

A12=22/05/01 =DATEDIF(A13,A12,"M") ie; how many months between A12 16


A13=25/12/99 & A13

A14=15/12/01 =EOMONTH(A14,3) ie; the last day of the month 3 months


from A14

=31/03/20
02

A15=18/02/01 =EDATE(A15,-1) ie; the date 1 month before A15

=18/01/20
01

Imported Dates
SAP (and other Software) can import dates into Excel as 200011, which means the eleventh
week of the year 2000.
How to find out which month that is? Below is one way to achieve a result. However, since
Excel 2002 it is possible to use Text to Columns found under Data on the Worksheet Menu
Bar. At step 3 of 3 click the Advanced button. See Also: Convert Excel Dates and Excel Date
and Times
What we need to do is first understand how Excel sees dates and that is as what's known as
"Serial values". This is just a fancy name for whole numbers (times would add a decimal or
fraction). Excels date system (by default) Start s from 1/Jan/1900 and this is stored by Excel as
the Serial value 1, 2/Jan/1900 is 2 etc. You can see any dates "Serial value" by typing a valid date
in any cell, then formatting the cell as "General".
We first need to convert the year 2000 into a serial number and to do that we type 1/jan/2000 into
a cell and format it as "General". We get the serial value: 36526. Now we need to convert the
week number (11 in this case) to days, this can easily be done by multiplying 11*7 to get 77. then
we can add this to the year 2000 serial value (36526) and get 36603. If we now format this to a
date format we get: 18/Mar/2000

To bring this all together we will need to always extract the week number from the SAP date
(200011 in this case). and to do this we simply use: =RIGHT(A1,2) assuming the date is in cell
A1. this will return the Week number 11, but as text! So this "Text value" must be converted to a
true number, so we use the VALUE function: =VALUE(RIGHT(A1,2)). Obviously this will be
fine when the week number is two digits, but if it's only one it wont work, to handle this we use a
simple IF function and nest the LEN function into it's Logical_test argument and next the whole
formula within the VALUE function. =VALUE(IF(LEN(A1)=6,RIGHT(A1,2),RIGHT(A1,1))).
The LEN function simply returns the number of characters in text. So on the SAP date 200011
we could use:
=VALUE(IF(LEN(A1)=6,RIGHT(A1,2),RIGHT(A1,1)))*7+36526 and format the cell as a
date.
Next problem will be the year changing from 2000 to 2001 etc. to handle this we would use:
=DATEVALUE("1/Jan/"&LEFT(A1,4)) this would convert the SAP date: 200011 to the Serial
value: 36526. In other words it extracts the first 4 characters from the value 200011 (ie 2000) and
this is used in a text date of "1/Jan/2000" the DATEVALUE function simply converts this text
date to a serial value for us.
To bring the whole formula to a conclusion we would use:
=VALUE(IF(LEN(A1)=6,RIGHT(A1,2),RIGHT(A1,1)))*7+DATEVALUE("1/Jan/"&LEFT
(A1,4))
Which gives us: 36603 (18/Mar/2001) in the case of 200011, 36969 (19/Mar/2001) in the case
of: 200111
All you need to do is format the cell as "mmm" or use: =MONTH(C1) assuming your result is in
cell C1
Tips:
If you paste any formulas copied from a Webpage into an Excel cell, push F2 first. This will
prevent any problems.
The DATEDIF Function can also accept "Y", "D", "MD", "YM", "YD".The earliest date must
be first. It is provided in Excel 97 onwards for compatibility with Lotus 1-2-3.
Both the EOMONTH and EDATE are Excel Add-ins. Go to Tools>Add-ins-Analysis Toolpak.
If you use them without installing this Add-in you will get the #NAME? error.
You can use positive and negative numbers in the EOMONTH and EDATE functions.
See Also: Convert Excel Dates and Excel Date and Times

|| Text Formulas | Date Formulas | Number Formulas ||

Excel Number Formulas


When numbers are imported into Excel they may be converted to text, or not in a recognised
Excel format. Below are some examples of how you can convert the numbers to suit.

Number

Formula Used

Result

A18= 22-

=VALUE(RIGHT(A18,1)&LEFT(A18,FIND("-",A18)-1))

-22

A19= -22

=ABS(A19)

22

A20= 1995

=ROMAN(A20)

MCMXCV

A21= 25.499 =ROUND(A21,0)

25

A22= 15.999 =TRUNC(A22)

15

Tips:
A quick way to convert text numbers to real numbers is to place the number 1 in any cell, copy it
and then select your range containing the text numbers. Go to Edit>Paste special-Multiply and
click OK.
Another way to convert text numbers to real numbers is to use: =VALUE(A1) where A1 contains
the text number. Copy this down/across as far as needed, then highlight all the formulas and
copy, then go to Edit>Paste special-Values and click OK.
Have a lot of cells containing formulas that are showing the formula instead of the result? It is
most likely because the cells are formatted as Text (possibly due to importing). Select the cells
and format them as "General" (or any number format) then go to Edit>Replace and type = (equal
sign) in the "Find what" box. Now type another = (equal sign) in the "Replace with" and click
"Replace All". This will force all formula cells on the Worksheet to recalculate!

Nifty Excel Formulas Download a Workbook full of nifty Excel formulas: For Last Value,
Close Match, AutoFilter Lookup & Much More
Excel resources

SELF HELP
FREE Excel Help Forum (The place to get your questions answered). Get your questions
answered for free, often within minutes! The most popular area of our site. Give yourself and/or
your company totally free 24/7 support. You can even upload/download example files
Excel Formula Errors As soon as you have discovered how to use formulas in Excel, you will
likely need to lean how to correct or hide formula errors.
Excel Newsletter Archive Have a browse through our free Excel newsletter archives. Here you
will find a bit of everything from basic shortcuts to VBA for Excel. If you like what you see then
sign up, it's completely free!
DEBUG / EVALUATE FORMULA ERRORS #NULL!, #DIV/0!, #VALUE!,#REF!,#NAME?,
#NUM! and #N/A
FREE Excel Training Free Level 1 (Basic) Excel Training Compliments of Ozgrid!
FREE Excel Downloads All Excel downloads below here are free.
Excel Forum FAQ List of the most popular asked questions in the Excel help forum . Excel
Formulas through to Excel VBA macro code.
Excel Frequently Asked Questions and Answers . An ever growing list of popular questions
and answers.
See also: Excel resources

Charts
Excel Charts Here are many examples that can be used to create Excel charts with a difference.
The Excel charting pages listed here show many different charting techniques, examples and
solutions.

Charting in Excel
Below are many examples that can be used to create Excel charts with a difference. The Excel
charting pages listed here show many different charting techniques, examples and solutions. All
Excel charts are the brain-child of Andy Pope who is a regular poster on our FREE Excel
Help forum. He is also a well deserved Microsoft Most Valuable Person (MVP)

huge range of Charting Software | See Also: Excel Charting Lessons & Excel
Dashboards AVAILABLE AT 50% Off

Conditional Highlighting Axis Labels : The Excel chart on this page highlights the X axis
category labels when the monthly data drops below 25.

Polar Plot Charts : The polar plot is created using the Radar chart. This particular example
requires 2 data series in order to generate the spiral effect.

Pie Chart With Individual Slice Radius : Chart is a filled radar chart with multiple series.

Label High-low Line With Values : Uses an additional data series plotted on the secondary axis
to add values to the high-low lines.

XY Scatter Colouration Plot : The chart in both cases is a standard xy scatter plot where the
plot order of each data point determines the colour of the marker.

Custom Leader Lines : This chart has 2 textboxes for displaying information regarding the 1st
and 4th slice.

Positive/Negative Axis Labels on a Bar Chart : Axis label alignment when charting positive
and negative bars.

Bounding Chart Areas : Creating bounding area within xy scatter.

Pie Chart Data Markers : Use a pie chart as a data marker

Axis Pointer : Display pointer at end of axis

Display Total on Stacked Column : Display a cumulative total on a stacked column chart.

Invert if Negative : An step by step explanation on how to control the Invert if Negative
property.

Labeling Last Data Point : Label the Last data point in a chart using dummy data series.

Scrolling Excel Data Chart : Dynamic scrolling through data.

Excel Spotlight Chart : Alternate conditional dual category plot.

Excel Tile Chart : Conditional dual category plot.

Staggered Axis Labels : Various methods to create staggered axis.

Also see our huge range of Charting Software


Step Line Charts : Various ways and chart types that can be used to create a stepped line.

Another Column Chart With Varying Width Bars : Column chart that has variable width
bars, including a stacked style.

Dividing a Graphic Into Sections : Split a graphic into variable width sections.

Broken Lines for Formula Linked Data : An alternative to zero or joined points.

Automatic Removal of Zero Values in Excel Pie Chart . A pie chart that does not display zero
values.

Excel Chart Tips and Tricks There are many little known tricks that can be used with Excel
charts and these are just some of them. If you want your chart to update automatically, not plot
zeros, or have scrolling charts etc, then you will find it here!

Custom Charts
You have just spent hours creating your chart and its a looking exactly how you want it, the only
problem is you cannot stand the thought of having to do the same thing all over again for your
next chart(s). Below are three ways that will save you many hours.

Watch the latest videos Short and Sweet


Simply click on your chart to select it and then right click and select
on YouTube.com
Copy. Now all you have to do is paste your new chart where you want it
and change its Data range and Series.
More Excel Video
If your chart is on a Chart sheet then click the sheet name tab and hold
Tutorials
down your Ctrl key and drag the sheet to another location.
User Defined
Right click on your chart and select Chart type then click the Custom Types tab. At the bottom
of this page you will see the Select from box. From in here select User defined, now click Add.
Type in a name for your chart and a description if needed, then click OK.
Default to User Defined
Do exactly as above in User Defined but after clicking Add and typing in a name and
description click the Set as default chart button. Now each time you create a chart it will
default to your custom type.

Not Plotting Empty Cells


A very common problem with charts is that if your data range contains empty cells Excel will try
to plot them. This makes your chart drop off suddenly and leaves you looking at a chart with a
lot of missing data. Below are two ways this can be overcome. The second method would
probably suit most needs.
Hiding Rows or Columns
Let's assume you have a chart that is plotting sales figures by month. The month names are in
cells A1:A12 with their associated sales figures in B1:B12. This would mean if the current
month was April then your chart would be plotting 8 months of empty cells, as May:Dec figures
are not yet available. To avoid this, you could simply hide rows 5:12 (May:Dec). Excel will not
plot hidden rows. To hide these rows select them and go to Format>Rows>Hide.
Return #N/A
Using the same example as above in Hiding Rows or Columns follow these steps:

Place the month names Jan:Dec in cells C1:C12

In cell B1 type =NA() and copy it down to B12

In cell A1 type =IF(ISERROR(B1),B1,D1) and copy it down to A12

As you enter the sales figure for the month you will type over the =NA().
This will mean that if the sales figure has not been entered for any month both the month column
(Column A) and the sales figure column (Column B) will return #N/A. Excel will not plot
#N/A.

Changing the chart data range - quickly!


Let's assume you have a chart that is plotting dollar values in the range A1:A20. Now let's say
sometimes you need to add a new series eg; some comparison Pound values in range B1:B20
Drag and Drop
Highlight the range B1:B20, place your mouse pointer over any border of the highlighted range
until it changes to an arrow. Now click and drag the range onto the chart and drop it. You
should now see the chart Paste Special dialog box. You can also do this by copying your data
then choosing Paste Special from the Edit menu.

Scrolling Charts
Give your charts a professional look by using a Scrollbar to increase and decrease the data range
it is plotting. Just follow these easy steps:

On sheet1 In cell A1 type the heading Amounts and in cell B1 type the heading Months
and in cell C1 type the number 1.

Fill cells A2:A13 with some numeric values and in cells B2:B13 put the months of the
year i.e. Jan:Feb.

Go to Insert>Name>Define and type the name MyValues in the Names in workbook


box.

In the Refers to box type the formula =OFFSET($A$2,0,0,$C$1,1) and now click Add.

Repeat step 3, except replace "MyValues" with the name MyMonths. Repeat the last
step except replace $A$2 with $B$2. Click OK.

Click the Chart wizard from the Standard toolbar, select Line from the Chart types,
choose any type from the Chart sub-type. Click Next and then the Series tab.

Click Add, select cell A1 using the collapse dialog to the left of the Name box or type
Amounts. In the Values box Type =Sheet1!MyValues and in the Category (x) axis
labels type =Sheet1!MyMonths.

Step through the rest of the Wizard setting up the chart how you want and finally click
Finish.

Go to View>Toolbars>Forms and from this toolbar click the Scrollbar then click on
your Chart. Position and size the Scollbar on the Chart.

Right click on the Scrollbar and select Format Control then click the Control tab.
Change the Current value to 1, change the Minimum value to 1, change the Maximum
value to 12, change the Incremental change to 1.

Finally put $C$1 in the Cell link box and then click OK.

Now use the scrollbar to change the data range in your chart.

Changing Range Chart


Here is a great little trick that will allow you to change your chart range by selecting it from a
list. This one should impress the boss!

On sheet1 In cell A1 type the heading Amounts, in B1 type Prices, in C1 type Ages, in
D1 type Months.

Under these headings type put some values. Under Months put the 12 months of the year.

Click in cell F1 and go to Data>Validation. Select List from the Allow: box. In the
Source box type =$A$1:$C$1. Click OK.

In cell G1 put this formula: =IF(F1=A1,0,IF(F1=B1,1,IF(F1=C1,2,0))) This will make


the default (if F1 is blank) Amounts.

Go to Insert>Name>Define and type the name AnyColumns in the Names in


workbook box.

In the Refers to box type the formula


=OFFSET($A$2,0,$G$1,COUNTA($D$2:$D$13),1) and now click Add.

Click the Chart wizard from the Standard toolbar, select Line from the Chart types,
choose any type from the Chart sub-type. Click Next and then the Series tab.

Click Add, select cell F1 using the collapse dialog to the left of the Name box or type
=Sheet1!$F$1.

In the Values box Type =Sheet1!AnyColumns and in the Category (x) axis labels type
=Sheet1!$D$2:$D$13

Step through the rest of the Wizard setting up the chart how you want but for the Chart
location choose As object in, finally click Finish.

Position and size your chart so you can select from your list in cell F1.

Now select a name from your list in F1 and your chart series range will change accordingly.

Two Handy Dynamic Ranges For Charts


See Dynamic ranges for full instructions and more
Expand Down One Row Each Month
In the Refers to box type: =OFFSET($A$1,0,0,MONTH(TODAY()),1)
Expand Down One Row Each Week
In the Refers to box type: =OFFSET($A$1,0,0,WEEKNUM(TODAY()),1)
You can also change the Columns the dynamic range will span by simply changing the last
Argument of the OFFSET function to a higher number than 1.
You could even expand across your Columns dynamically by placing another COUNT or
COUNTA formula as the last argument, instead of 1. See below:
In the Refers to box type: =OFFSET($A$1,0,0,COUNTA($A:$A),COUNTA($1:$1))
This dynamic range will now also expand across Columns in Row 1. So if you add another
Column to your Table the dynamic range will automatically incorporate it.
To try and give you a better understanding of the OFFSET formula, read the text below taken
from the Excel help file.
OFFSET(reference,rows, cols,height,width)
Reference : is the reference from which you want to base the offset. Reference must be a
reference to a cell or range of adjacent cells; otherwise, OFFSET returns the #VALUE! error
value.
Rows : is the number of rows, up or down, that you want the upper-left cell to refer to. Using 5
as the rows argument specifies that the upper-left cell in the reference is five rows below
reference. Rows can be positive (which means below the Starting reference) or negative (which
means above the Starting reference).
Cols : is the number of columns, to the left or right, that you want the upper-left cell of the result
to refer to. Using 5 as the cols argument specifies that the upper-left cell in the reference is five
columns to the right of reference. Cols can be positive (which means to the right of the Starting
reference) or negative (which means to the left of the Starting reference).
If rows and cols offset reference over the edge of the worksheet, OFFSET returns the #REF!
error value.
Height : is the height, in number of rows, that you want the returned reference to be. Height
must be a positive number.

Width : is the width, in number of columns, that you want the returned reference to be. Width
must be a positive number.
If height or width is omitted, it is assumed to be the same height or width as reference.

See also: Excel resources

commission/tax formulas. Do this often? Free Custom Excel Functions


Add-in
Calculate Sliding Scale Tax Calculating tax, or commission that is based on a sliding scale, or
by bracket, can be complicated. The Excel formula here is one that can be used using Excel's
built in function/formulas. That is, the IF function/formula and the SUM function/formula.
Calculating tax, or commission that is based on a sliding scale, or by bracket, can be
complicated. The formula below is one that can be used using Excel's built in function/formulas.
That is, the IF function/formula and the SUM function/formula. The formula that can be used is;
=IF(A5>Level4Tax,SUM((A5-Level4Tax
*Level4TaxRate,Level3TaxAmount*Level3TaxRate,Level2TaxAmount*Level2TaxRate,Level1T
axAmount*Level1TaxRate),IF(A5>Level3Tax,SUM((A5Level3Tax)*Level3TaxRate,Level2TaxAmount*Level2TaxRate,Level1TaxAmount*Level1TaxR
ate),IF(A5>Level2Tax,SUM((A5Level2Tax)*Level2TaxRate,Level1TaxAmount*Level1TaxRate),SUM((A5Level1Tax)*Level1TaxRate)),0)))
I have color coded the formula for easier reading. As you can see, this formula uses Named
Ranges for easier reading and modification. A named range can be created by selecting the cell,
then typing the name wanted in the Name Box (left of formula bar) and pushing Enter.
To make this easier to read, I have placed the cell names next to their named cell. In the formula
above, only the grey cells are being used. The last column (Amount of Tax Payable on) is the
result of subtracting the Level*Tax (one row down) from the Level*Tax on the same row. For
example, $13,000.00 (Level1TaxAmount) is derived by subtracting Level2Tax (25000) from
Level1Tax (12000). That is:
=Level2Tax-Level1Tax

If you prefer, these key numbers, can become Named Constants as opposed to Named Ranges .
For example, to create the Named Constant: Level1Tax you would go to Insert>Name>Define
and type: Level1Tax in the Names in workbook: box, then: =12000 in the Refers to: box, then
click Add.
Using Excel Vlookup Formula
There is another way, which some may prefer where the VLOOKUP function/formula is used.
This method relies on some "Quick deductions" being pre calculated and placed at the end of the
white & grey table shown above.
=A3*VLOOKUP(A3,$B$14:$G$18,3)-VLOOKUP(A3,$B$14:$G$18,6)
This is best seen by Downloading Working Example Thanks to Albert Tsang for this
excellent method.
We can go one step further toward simplifying the calculation by using Named Formulas for
each tax level calculation. After doing this, we can then use;
=IF(A1>Level4Tax,Level4TaxCalc,IF(A1>Level3Tax,Level3TaxCalc,IF(A1>Level2Tax,Level2
TaxCalc,IF(A1>Level1Tax,Level1TaxCalc,0))))

Here are the steps to achieve this. BTW, this method can also be used to overcome the 7 nested
IF Function limitation .
1) Create Named Ranges, or Named Constants that will hold the figures needed. See screen shot
above.
2) Place you Gross pays in cell A1 down.
3) Select cell B1 and go to Insert>Name>Define.
4) In the Names in workbook: box type: Level1TaxCalc Then, in the Refers to: box type:
=SUM((A1-Level1Tax)*Level1TaxRate) Then click Add. **Note how we have referred to cell
A1. This now makes the Named Formula (Level1TaxCalc) always look on the same row in the
immediate column to the left for the gross pay.
5) Repeat step 4 using the names and formulas shown below;
Level2TaxCalc
=SUM((A1-Level2Tax)*Level2TaxRate,Level1TaxAmount*Level1TaxRate)
Level3TaxCalc
=SUM((A1Level3Tax)*Level3TaxRate,Level2TaxAmount*Level2TaxRate,Level1TaxAmount*Level1TaxR
ate)
Level4TaxCalc
=SUM((A1Level4Tax)*Level4TaxRate,Level3TaxAmount*Level3TaxRate,Level2TaxAmount*Level2TaxR
ate,Level1TaxAmount*Level1TaxRate)
It is important to know that Level*TaxCalc will ALWAYS look on the same row, but left
column for the gross pay figure.

Calculate Fixed Rate Tax The Excel formula VLookup can be used to look for numeric values
in lists and tables and to use those values in a calculation. A perfect example of how VLookup
can be used to glean information is to work out how much tax you are required to pay.
The VLookup Function can be used to look for numeric values in lists and tables and to use
those values in a calculation. A perfect example of how VLookup can be used to glean
information is to work out how much tax you are required to pay. To do this, we must find an
appropriate tax rate based on an annual salary and take into consideration the number of
dependents.

Ideally, one should use Dynamic Named Ranges for Lookup tables. However, for easier reading
we have used range addresses here.
Consider the following table:

VLookup generally requires three arguments (lookup_value,table_array,col_index_num). The


lookup value is the annual income, the table array is the address or location of the Tax Table
above (A3:F19) and the column index number is the relevant column applying; No Dependents,
1 Dependent, 2 Dependents etc.
Let's say that we earn $60,000 per year, and we have no Dependents. The VLookup function to
work out the tax payable is written as =VLOOKUP(H3,A3:F19,2) and will return a value of
$18,000. This is because VLookup scans down the first column looking for the lookup value
($60,000) in the table, then returns the value in column 2 of the table on the same row ($18,000).
This is because the exact amount of $60,000 exists under Annual Income.
When There is no Exact Match
Let's look at another example. This time, let's say we earn $43,000 per year and we have 3
Dependents. The Function is written in the same way =VLOOKUP(H3,A3:F19,5). However as
$43,000 cannot be found in the first column of the Tax Table, VLookup will step back to the
closest value, so it scans down the first column looking for the lookup value ($43,000) in the
table, it can't find it, so it steps back to the closest value. In this case $40,000. It then returns the
value in column 5 of the table in the same row ($7,600).
To see details on this see: VLookup here.
Using VLookup to work out Commission Due
You can also easily use this type of VLookup in a formula. Let's say you wanted to work out
how much money was due to you, when your earnings were worked out as a percentage of sales:

You would write the formula as =D3*VLOOKUP(D3,$A$2:$B$10,2). If your sales are 5000,
then the commission due will be $1,125.00. This is because 5000 is multiplied by the result of
the VLookup. VLookup scans down the first column until it locates 5000, then returns the value
in column 2 on the same row.
If your sales are 750, then the commission due will be $112.50. This is because 750 is multiplied
by the result of the VLookup. In this case the VLookup cannot find 750 when it scans down the
first column of the table. It steps back to the closest value, 500 and returns the value in the
second column on the same row, 15%. So in effect our formula is taking the amount of sales,
750 and multiplying it by 15%, the amount of commission due.
Tip
A great way to display values to make your table easier to read and understand when you wish to
use VLookup would be to format your cells with a custom format of "100 to 499" in cell A2,
"500 to 999" in A3 etc, so your values display like in the following table. It is important to note
that these are only displayed values and the true underlying value is still the same as shown in
A2:A10 in the table above.

PIVOT TABLES
Excel Pivot Tables Take the FREE online tutorial on Excel Pivot Tables. Download the Excel
Workbook examples are more.
Pivot Table Tutorial
Pivot Table Grouping Problems
Calculated Fields in Pivot Tables Add your own custom calculations in Pivot Tables.
Grouping Pivot Table Data Grouping Pivot Table Data. How to Group so you don't get: Cannot
Group that Selection

PivotTables are used to display and extract a variety of information from a table of data that
resides within either Microsoft Excel or another compatible database type. PivotTables are
frequently used to extract statistical information from raw data. You can drag around the different
fields within a PivotTable to view its data from different perspectives.
I thought we would look at a really nifty feature of Pivot Tables the ability to insert a calculated
field. For example, if you had a pivot table set up, with an amount displayed in the Data Items
area, you may wish to display the GST (tax) component of the Amount Owing so you can see it
at a glance.
First you need to create the pivot table. In our list, we have Names in column A and Amount
Owing in Column B. We created a pivot table and moved the Names field to the Row area and
the Amount Owing to the Data area.
Download Pre Example

With our PivotTable created, it would be nice if we could see at a glance the GST component of
each of the amounts owing. We can do this by inserting what is known as a calculated field. To

do this easily, select PivotTable on the PivotTable toolbar (if this toolbar is not displayed, go to
View>Toolbars and select PivotTable, or right click in the toolbar area of your screen and select
PivotTable) then select Formulas>Calculated Field. This will display the Insert Calculated
Field dialog box. The first thing we need to do is give our new field a Name. We will call ours
GST. Now move to the Formula area and type in the following formula =Amount Owing/10,
select Add, then Close. This will insert a column to the right of the Sum of Amount Owing
with the GST Amount displayed. You can of course use any formula you like in a calculated
field, however one important thing to remember about using formulas in calculated fields is
that you cannot use Excel formulas that REQUIRE a range reference.

Você também pode gostar