docx

advertisement
Some tips and tricks for Excel
Overview
You can think of Excel as a visual calculator and an organization tool for data. While
it doesn’t provide much in the way of database functionality, one can still
manipulate data fairly easily. I’ve found it very valuable as a tool that provides a
couple of things:


A stable (or perpetual) platform for calculation;
A platform for creating keystroke macros that executes repetitive tasks (so
long as you are using non-Mac versions that retain VBA or Visual Basic for
Applications functionality).
Many tasks (such as the next couple of homework assignments) may appear
daunting at first. As with many tasks, this may be superficial and overcome by
planning what you are about to do. Additionally, taking full advantage of the copy
and paste functions can significantly reduce the amount of labor you put into a
spreadsheet or spreadsheet model.
Workbook Structure
A workbook, which is considered the “document,” is organized by worksheets. At
the bottom of the Excel window are a number of worksheet tabs. By default, these
are named “Sheet 1,” “Sheet 2” and so on. By clicking on any given tab, that
worksheet then becomes active. Worksheets can be your typical spreadsheet, or
they may be a freestanding table or chart (if you preferred that layout instead of a
mix of sheet and graphics).
You may also change the name of the worksheets. Double-clicking on the tab makes
the worksheet name editable. This becomes very helpful with the organization of
data you have in your workbook. You will also notice that you can have many more
sheets than are visible – arrow-buttons allow you to scroll back and forth, as well as
navigate to the first and last sheets.
Entering Data
What you see above is a screenshot of data in the spreadsheet and a view of what’s
actually displayed in the spreadsheet. Right now, they are one and the same. The
string xyz is located in what we call a cell. We refer to cells by their row and column
location (similar to a Cartesian coordinate system). Rows are referred to as
numbers, columns by letters. On my version of Excel (a Mac version…) there are
104,586 rows. The number of columns goes out to “XFD.” This only makes sense if
you realize that the column numbering starts at “A,” proceeds to “Z” then transform
to “AA” on the 27th column (AA, AB, AC…AZ, BA,BB, BC…BZ, CA, CB, CC…CZ, etc.).
In cell “A1” you will notice the text xyz. The text xyz is also repeated in the formula
box at the top of the screenshot. When you type text and numbers into a cell, these
two will reflect each other. In addition, the cell box will let you know which cell or
array of cells you currently have selected.
Copying and Pasting
Copying and pasting in Excel is pretty straightforward. You can use the copy and
paste buttons at the top of the Excel window, or you can use the keyboard shortcuts
to accomplish the same tasks


To copy: ctrl-c
To paste: ctrl-v
Whichever method you use, the command will copy whatever cells you have “active”
whether it is a single cell, an array of cells, or in some circumstances disjointed cells
or arrays.
Selecting multiple cells takes on a few different flavors depending on the task.
Clicking on a cell selects it. Dragging your cursor across a row, column or complex
array also selects those cells. If you are selective and want to copy disjointed cells,
merely click on those cells while holding down the ctrl button (however, you should
be aware that Excel won’t copy those cells in the same disjointed manner, and this
type of selection only works with cells in the same column, or same row).
Probably the biggest timesaver is to use the fill handle located at the bottom-right
of the cell selection frame (that little square). When your mouse cursor (typically a
full cross) hovers over the fill handle, the cross changes into a smaller cross letting
you know you can take advantage of its capabilities. When you keep the left mouse
button pressed, the contents of that cell are copied to whichever cells you expand
the selection to.
An additional help, is that if you select a series of numbers then use the fill handle,
Excel recognizes the series and expands the series based on the pattern it
recognizes (useful for filling in sequential numbers, dates, etc.).
Referencing cells, arrays, worksheets, workbooks
As mentioned previously, cells are referred to by their row and column location. An
array of cells are referred to by their first and last cell, separated by a colon. This is
best understood with single row and column arrays. However if you want to refer
to an array that is, say, two columns by four rows, it is referred to by the
combination of its top-left cell and its bottom-right cell separated by a colon.
As with functions and formulas, if you wish to refer to the contents of another cell,
precede any reference by an equals sign (=A1).
It is possible to refer to cells on other worksheets, or even in other workbooks.
When referring to a cell on another worksheet, separate the sheet name and the cell
reference by an exclamation point (=Sheet1!A1). Note, however, that if your
worksheet name includes spaced (i.e., First Sheet), then the reference to that
worksheet needs to be bounded by single quotes (=’First Sheet’!A1).
Referring to cells in other (external) workbooks is a bit more convoluted, and not
very common (for me, at least). One reason why this is cumbersome is that both (or
all) workbooks that are referred to need to be together in order for these references
to maintain their integrity – that is, if you copy one workbook to a usb drive and use
it on another computer, any link to external workbooks are no longer valid.
However, these links to external workbooks are still maintained even when the
source workbook is not open or active. Is that cool, or what?
I won’t bother showing you this, but know it is possible. It’s not that complicated,
but procedurally can be confusing. But, as an example, the following references a
cell in another workbook on my hard disk. Try typing this one in…
='Macintosh HD:Users:rich:Documents:excel:[Second Workbook.xlsx]Sheet1'!$A$1
One last aspect of referencing is to make the distinction between absolute and
relative cell references. This is very helpful when it comes to copying and pasting,
but it can also lead to some unexpected results if you aren’t mindful of which you
are using.
By default, any reference in Excel is a relative reference. This means that the cell or
cells it refers to is merely in a location relative to where you are typing in that
reference.
For example, if I type “=A1” in the cell A2, what I’m actually telling Excel to do is to
display the contents of the cell just above it. If I copy what is in cell A2 to cell B4,
what is displayed in cell B4 will be the contents of the cell just above it: cell B3.
While relative references are the default, I can also specify an absolute reference. I
do so by placing a dollar sign ($) in front of the column AND the row designations in
my reference. By typing “=$A$1” in cell A2, the contents of cell A1 get displayed
(just as in the relative reference scheme). However, if I copy the contents of cell A2
to cell B4, the contents of cell A1 are displayed.
You can think of those dollar signs as anchors. You can anchor both column and
row, or you can anchor the column and let the row remain relative, or you can let
the column remain relative and anchor the row.
Formulas
In addition to typing in text and numbers, Excel understands mathematical
operations just like a calculator. Understanding the syntax of formulas allows will
greatly enhance the functionality of this program and take you into areas that begin
to use Excel to its full potential.
To some extent, you are familiar with the most basic concept of a formula: the cell
reference. Getting beyond the “display the contents of cell x” means using an
equation as a number sentence. It all begins with the equals sign.
Any time you want to insert a formula into a cell, begin your statement with an
equals sign. Excel will expect that anything that follows is a statement to execute.
The trick to having a valid equation is an understanding of the order of operations.
In this regard, parentheses will be your closest friends.
Symbol
+
*
/
^
(
)
Operation
Addition
Subtraction
Multiplication
Division
Exponent
Open parenthesis
Close parenthesis
When you type a formula in a cell and press “enter,” the cell will display the result of
the formula. If you click on a cell that contains a formula, it will still display the
result of the formula in the cell, but the function box will display the formula itself.
Double-clicking on the cell with a formula will display the formula in the cell and in
the formula box.
Two things may happen when you enter an incorrect formula: an unintended
number will result, or you will get a system error. I say “unintended number”
instead of incorrect number, because Excel is stupid. It will do (or attempt to do)
exactly what you tell it to do, nothing more and nothing less. You will get a system
error if Excel is unable to execute the formula you are requesting.
Some possible errors:
Error
#########
#DIV/0
#N/A
#NAME?
Explanation
Column width is too narrow to display the number (to correct, widen the column)
Formula attempts to divide by zero or by a blank cell which is impossible
Formula references a cell that returns the “Not available” value
Formula appears to use a cell name but the cell name has unmatched quotes, is not
#NULL
#NUM!
#REF!
#VALUE!
recognized or is misspelled
Formula attempts to provide value that doesn’t exist
Formula attempts an impossible operation such as calculating the square root of a
negative value
Formula references a range that doesn’t or no longer exists. Often happens when you a
cell has been deleted from the worksheet
Formula tries to use text in a mathematical operation
Respect your order of operations. In a nutshell, you can remember the order of
operations with a mnemonic PEMDAS






Parentheses
Exponents
Multiplication
Division
Addition
Subtraction
Parentheses can also be cumbersome, because for every open parenthesis you are
required to have a close parenthesis (and vice-versa). Here are some examples of
simple formulas:
2+2
2x2
24 x 2
22
=2+2
=2*2
=2^4*2
=2/2
One of the more flexible aspects of Excel is that you can use a cell reference in the
place of an actual number. This does two things for us:


We don’t have to type in a number (we can actually click on the cell that has
the number we want to use while editing the formula and it gets inserted into
the statement);
Once the formula with a cell reference is in place, the result of the formula
gets updated automatically whenever the value in the referred cell changes.
Functions
Excel provides many built-in tools to allow the manipulation of text and numbers
that save you the hassle of coding a formula into a cell. You can insert a formula into
a cell by using the “insert function” tool button and selecting the formula you wish,
or if you know the formula and its syntax, you can type it in yourself.
Functions are extremely broad in their scope. You can use functions for numerical,
statistical, logical and text operations (among other things). As with cell references
and formulas, all functions are preceded with an equals sign.
Download