Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Excel 2003 Formulas
Excel 2003 Formulas
Excel 2003 Formulas
Ebook1,123 pages10 hours

Excel 2003 Formulas

Rating: 4 out of 5 stars

4/5

()

Read preview

About this ebook

Everything you need to know about
* Mastering operators, error values, naming techniques, andabsolute versus relative references
* Debugging formulas and using the auditing tools
* Importing and exporting XML files and mapping the data tospecific cells
* Using Excel 2003's rights management feature
* Working magic with array formulas
* Developing custom formulas to produce the results you need


Here's the formula for Excel excellence

Formulas are the lifeblood of spreadsheets, and no one can bring aspreadsheet to life like John Walkenbach. In this detailedreference guide, he delves deeply into understanding, creating, andapplying formulas in everything from basic workbooks to charts,pivot tables, and more advanced Excel applications. He examinesfinancial formulas, explores the many options made possible witharray formulas, teaches you to develop custom worksheet functionswith VBA, and much more. Once again, "Mr. Spreadsheet" will astoundyou with the breadth and depth of Excel's capacity.

CD-ROM Includes
* Trial version of the author's award-winning Power Utility Pak 5
* More than 90 sample workbooks illustrating key formula concepts
LanguageEnglish
PublisherWiley
Release dateJun 24, 2011
ISBN9781118053331
Excel 2003 Formulas

Read more from John Walkenbach

Related to Excel 2003 Formulas

Related ebooks

Enterprise Applications For You

View More

Related articles

Reviews for Excel 2003 Formulas

Rating: 4.14999977 out of 5 stars
4/5

10 ratings1 review

What did you think?

Tap to rate

Review must be at least 10 words

  • Rating: 5 out of 5 stars
    5/5
    Great book. Increased my knowledge of Excel forumula's and helped optimize the structure of my workbooks.

Book preview

Excel 2003 Formulas - John Walkenbach

Chapter 1: Excel in a Nutshell

In This Chapter

A brief history of Excel

The object model concept in Excel

The workings of workbooks

The user interface

The two types of cell formatting

Worksheet formulas and functions

Objects on the worksheet's invisible drawer layer

Macros, toolbars, and add-ins for Excel customization

Analysis tools

Protection options

Microsoft Excel has been referred to as the best application ever written for Windows. You may or may not agree with that statement, but you can't deny that Excel is one of the oldest Windows products and has undergone many reincarnations and face-lifts over the years. Cosmetically, the current version — Excel 2003 — barely even resembles the original version (which, by the way, was written for the Macintosh). However, many of Excel's key elements have remained intact over the years, with significant enhancements, of course.

This chapter presents a concise overview of the features available in the more recent versions of Excel, with specific emphasis on Excel 2003. It sets the stage for the subsequent chapters and provides a transition for those who have used other spreadsheet products and are moving up to Excel. Hard-core Lotus 1-2-3 users, for example, usually need some help to start thinking in Excel's terms.

Note_Icon.eps If you're an old hand at Excel, you may want to ignore this chapter or just skim through it quickly.

The History of Excel

You probably weren't expecting a history lesson when you bought this book, but you may find this information interesting. At the very least, this section provides fodder for the next office trivia match.

Spreadsheets comprise a huge business, but most of us tend to take this software for granted. In the pre-spreadsheet days, people relied on clumsy mainframes or calculators and spent hours doing what now takes minutes.

It Started with VisiCalc

Dan Bricklin and Bob Frankston conjured up VisiCalc, the world's first electronic spreadsheet, back in the late 1970s when personal computers were unheard of in the office environment. They wrote VisiCalc for the Apple II computer, an interesting machine that seems like a toy by today's standards. VisiCalc caught on quickly, and many forward-looking companies purchased the Apple II for the sole purpose of developing their budgets with VisiCalc. Consequently, VisiCalc is often credited for much of Apple II's initial success.

Then Came Lotus

When the IBM PC arrived on the scene in 1982, thus legitimizing personal computers, VisiCorp wasted no time porting VisiCalc to this new hardware environment. Envious of VisiCalc's success, a small group of computer enthusiasts at a start-up company in Cambridge, Massachusetts, refined the spreadsheet concept. Headed by Mitch Kapor and Jonathon Sachs, the company designed a new product and launched the software industry's first full-fledged marketing blitz. Released in January 1983, Lotus Development Corporation's 1-2-3 proved an instant success. Despite its $495 price tag (yes, people really paid that much for software), it quickly outsold VisiCalc and rocketed to the top of the sales charts, where it remained for many years. Lotus 1-2-3 was, perhaps, the most popular application ever.

Microsoft Enters the Picture

Most people don't realize that Microsoft's experience with spreadsheets extends back to the early 1980s. In 1982, Microsoft released its first spreadsheet — MultiPlan. Designed for computers running the CP/M operating system, the product was subsequently ported to several other platforms, including Apple II, Apple III, XENIX, and MS-DOS. MultiPlan essentially ignored existing software user-interface standards. Difficult to learn and use, it never earned much of a following in the United States. Not surprisingly, Lotus 1-2-3 pretty much left MultiPlan in the dust.

Excel partly evolved from MultiPlan, first surfacing in 1985 on the Macintosh. Like all Mac applications, Excel was a graphics-based program (unlike the character-based MultiPlan). In November 1987, Microsoft released the first version of Excel for Windows (labeled Excel 2 to correspond with the Macintosh version). Excel didn't catch on right away, but as Windows gained popularity, so did Excel. Lotus eventually released a Windows version of 1-2-3, and Excel had additional competition from Quattro Pro — originally a DOS program developed by Borland International, then sold to Novell, and then sold again to Corel (its current owner).

Excel Versions

Excel 2003 is actually Excel 11 in disguise. You may think that this name represents the eleventh version of Excel. Think again. Microsoft may be a successful company, but their version-naming techniques can prove quite confusing. As you'll see, Excel 2003 actually represents the ninth Windows version of Excel. In the following sections, I briefly describe the major Windows versions of Excel.

Excel 2

The original version of Excel for Windows, Excel 2 first appeared in late 1987. It was labeled Version 2 to correspond to the Macintosh version (the original Excel). Because Windows wasn't in widespread use at the time, this version included a run-time version of Windows — a special version with just enough features to run Excel and nothing else. This version appears quite crude by today's standards, as shown in Figure 1-1.

540734 fg0101.tif

Figure 1-1: The original Excel 2 for Windows. Excel has come a long way since its original version. (Photo courtesy of Microsoft Corporation)

Excel 3

At the end of 1990, Microsoft released Excel 3 for Windows. This version offered a significant improvement in both appearance and features. It included toolbars, drawing capabilities, worksheet outlining, add-in support, 3-D charts, workgroup editing, and lots more.

Excel 4

Excel 4 hit the streets in the spring of 1992. This version made quite an impact on the marketplace as Windows increased in popularity. It boasted lots of new features and usability enhancements that made it easier for beginners to get up to speed quickly.

Excel 5

In early 1994, Excel 5 appeared on the scene. This version introduced tons of new features, including multisheet workbooks and the new Visual Basic for Applications (VBA) macro language. Like its predecessor, Excel 5 took top honors in just about every spreadsheet comparison published in the trade magazines.

Excel 95

Excel 95 (also known as Excel 7) shipped in the summer of 1995. On the surface, it resembled Excel 5 (this version included only a few major new features). But Excel 95 proved to be significant because it presented the first version to use more advanced 32-bit code. Excel 95 and Excel 5 use the same file format.

Excel 97

Excel 97 (also known as Excel 8) probably offered the most significant upgrade ever. The toolbars and menus took on a great new look, online help moved a dramatic step forward, and the number of rows available in a worksheet quadrupled. And if you're a macro developer, you may have noticed that Excel's programming environment (VBA) moved up several notches on the scale. Excel 97 also introduced a new file format.

Excel 2000

Excel 2000 (also known as Excel 9) was released in June of 1999. Excel 2000 offered several minor enhancements, but the most significant advancement was the ability to use HTML as an alternative file format. Excel 2000 still supported the standard binary file format, of course, which is compatible with Excel 97.

Excel 2002

Excel 2002 (also known as Excel 10) was released in June of 2001, and is part of Microsoft Office XP. This version offered several new features, most of which are fairly minor and were designed to appeal to novice users. Perhaps the most significant new feature was the capability to save your work when Excel crashes, and also recover corrupt workbook files that you may have abandoned long ago. Excel 2002 also added background formula error checking and a new formula-debugging tool.

Excel 2003

Excel 2003 (also known as Excel 11) was released in the fall of 2003. This version has very few new features. Perhaps the most significant new feature is the ability to import and export XML files and map the data to specific cells in a worksheet. In addition, Microsoft introduced some rights management features that allow you to place restrictions on various parts of a workbook (for example, allow only certain users to view a particular worksheet). This version also allows you to specifically designate a range to be a list. The SUBTOTAL function has also been enhanced, and long-time problems with many of the statistical functions have been corrected. In addition, Excel 2003 has a new Help system and a new research feature that enables you to look up a variety of information in the task pane (some of these require a fee-based account).

Note_Icon.eps For some reason, Microsoft chose to offer two sub-versions of Excel 2003. The XML and rights management features are available only in the version of Excel that's included with the Professional version of Office 2003.

The Object Model Concept

If you've dealt with computers for any length of time, you've undoubtedly heard the term object-oriented programming. An object essentially represents a software element that a programmer can manipulate. When using Excel, you may find it useful to think in terms of objects, even if you have no intention of becoming a programmer. An object-oriented approach can often help you keep the various elements in perspective.

Excel objects include the following:

• Excel itself

• An Excel workbook

• A worksheet in a workbook

• A range in a worksheet

• A button on a worksheet

• A ListBox control on a UserForm (a custom dialog box)

• A chart sheet

• A chart on a chart sheet

• A chart series in a chart

Notice that something of an object hierarchy exists here: The Excel object contains workbook objects, which contain worksheet objects, which contain range objects. This hierarchy is called Excel's object model. Other Microsoft Office products have their own object model. The object model concept proves to be vitally important when developing VBA macros. Even if you don't create macros, you may find it helpful to think in terms of objects.

The Workings of Workbooks

One of the most common Excel objects is a workbook. Everything that you do in Excel takes place in a workbook, which is stored in a file with an .xls extension.

Beginning with Excel 2000, you can also use HTML as a native file format for Excel. Because this file must store lots of information needed to recreate the workbook, you'll find that the HTML files generated by Excel are very bloated. So unless you have a real need to save your work in HTML by using this feature, you should use the normal XLS file format.

An Excel workbook can hold any number of sheets (limited only by memory). The four types of sheets are:

• Worksheets

• Chart sheets

• XLM macro sheets (obsolete, but still supported)

• Dialog sheets (obsolete, but still supported)

You can open as many workbooks as you want (each in its own window), but only one workbook is the active workbook at any given time. Similarly, only one sheet in a workbook is the active sheet. To activate a different sheet, click its corresponding tab at the bottom of the window, or press Ctrl+PgUp (for the next sheet) or Ctrl+PgDn (for the previous sheet). To change a sheet's name, double-click its Sheet tab and enter the new text for the name. Right-clicking a tab brings up a shortcut menu with some additional sheet-manipulation options.

You can also hide the window that contains a workbook by using the Window ⇒ Hide command. A hidden workbook window remains open, but not visible. Use the Window ⇒ Unhide command to make the window visible again. A single workbook can display in multiple windows (select Window ⇒ New Window). Each window can display a different sheet.

Worksheets

The most common type of sheet is a worksheet — which you normally think of when you think of a spreadsheet. Every Excel worksheet has 256 columns and 65,536 rows. And to answer a common question, the number of rows and columns is permanently fixed; you can't change it. Despite what must amount to thousands of requests from users, Microsoft refuses to increase the number of rows and columns in a workbook. You can hide unneeded rows and columns to keep them out of view, but you can't increase the number of rows or columns.

Note_Icon.eps Versions prior to Excel 97 support only 16,384 rows in a worksheet.

Having access to more cells isn't the real value of using multiple worksheets in a workbook. Rather, multiple worksheets are valuable because they enable you to organize your work better. Back in the old days, when a spreadsheet file consisted of a single worksheet, developers wasted a lot of time trying to organize the worksheet to hold their information efficiently. Now, you can store information on any number of worksheets and still access it instantly.

You have complete control over the column widths and row heights and you can even hide rows and columns (as well as entire worksheets). You can display the contents of a cell vertically (or at an angle) and even wrap around to occupy multiple lines.

Note_Icon.eps By default, every new workbook starts out with three worksheets. You can easily add a new sheet when necessary, so you really don't need to start with three sheets. You may want to change this default to a single sheet. To change this option, use the Tools ⇒ Options command, click the General tab, and change the setting for the Sheets in New Workbook option.

Chart Sheets

A chart sheet normally holds a single chart. Many users ignore chart sheets, preferring to use embedded charts, which are stored on the worksheet's drawing layer. Using chart sheets is optional, but they make it a bit easier to print a chart on a page by itself, and they prove especially useful for presentations. I discuss embedded charts (or floating charts on a worksheet) later in this chapter.

XLM Macro Sheets

An XLM macro sheet (also known as an MS Excel 4 macro sheet) is essentially a worksheet, but it has some different defaults. More specifically, an XLM macro sheet displays formulas rather than the results of formulas. Also, the default column width is larger than in a normal worksheet.

How Big Is a Worksheet?

It's interesting to stop and think about the actual size of a worksheet. Do the arithmetic (256 × 65,536), and you'll see that a worksheet has 16,777,216 cells. Remember that this is in just one worksheet. A single workbook can hold more than one worksheet.

If you're using an 800 x 600 video mode with the default row heights and column widths, you can see 12 columns and 28 rows (or 336 cells) at a time — which is about .002 percent of the entire worksheet. In other words, nearly 50,000 screens of information reside within a single worksheet.

If you entered a single digit into each cell at the relatively rapid clip of one cell per second, it would take you about 194 days, nonstop, to fill up a worksheet. To print the results of your efforts would require more than 36,000 sheets of paper — a stack about six feet high.

As the name suggests, an XLM macro sheet is designed to hold XLM macros. As you may know, the XLM macro system consists of a holdover from previous versions (version 4.0 or earlier) of Excel. Excel 2003 continues to support most XLM macros for compatibility reasons, but it no longer provides the option of recording an XLM macro. This book doesn't cover the XLM macro system; instead, it focuses on the more powerful VBA macro system.

Dialog Sheets

In Excel 5 and Excel 95, you can create a custom dialog box by inserting a special dialog sheet. When you open a workbook that contains an Excel 5/95 dialog sheet, the dialog sheet appears as a sheet in the workbook. Excel 97 and later versions still support these dialog sheets, but they provide a much better alternative: UserForms. You can work with UserForms in the VB Editor.

Tip_Icon.eps If, for compatibility purposes, you need to insert an Excel 5/95 dialog sheet in later versions of Excel, you won't find the command to do so on the Insert menu. You can only add an Excel 5/95 dialog sheet by right-clicking any Sheet tab and selecting Insert from the shortcut menu. Then, in the Insert dialog box, click the MS Excel 5.0 Dialog icon.

Excel's User Interface

A user interface (UI) is the means by which an end user communicates with a computer program. A UI includes elements such as menus, dialog boxes, toolbars, and keystroke combinations, as well as features such as drag-and-drop. For the most part, Excel uses the standard Windows UI to accept commands.

Menus

Beginning with Excel 97, Excel's UI deviates from the standard Windows UI by providing non-standard Windows menus. The menus in Excel 97 and later versions are actually toolbars in disguise — the icons that accompany some menu items are a dead give-away.

Excel's menu system is relatively straightforward. Excel contains two different menu bars — one for an active worksheet, the other for an active chart sheet or embedded chart. Consistent with Windows conventions, inappropriate menu commands are dimmed (grayed out) and commands that open a dialog box are followed by an ellipsis (three dots). Where appropriate, the menus list any available shortcut key combinations (for example, the Edit menu lists Ctrl+Z as the shortcut key for Edit ⇒ Undo).

Several menu items are cascading menus, and as such, lead to submenus that have additional commands (Edit ⇒ Fill represents a cascading menu, for example). A small arrow on the right of the menu item text indicates cascading menus.

New_Icon.eps An end user or developer can customize the entire menu system. To do so, choose the View ⇒ Toolbars ⇒ Customize command. You must understand that menu changes made by using this technique are permanent. In other words, the menu changes will remain in effect even if you close Excel and restart it. You can, however, reset the menus at any time. Select View ⇒ Toolbars ⇒ Customize. In the Customize dialog box, click the Toolbars tab. Select Worksheet Menu Bar (or Chart Menu Bar) from the Toolbars list, and click Reset.

Shortcut Menus

Excel also features dozens of shortcut menus. These menus appear when the user right-clicks after selecting one or more objects. The shortcut menus are context-sensitive. In other words, the menu that appears depends on the location of the mouse pointer when you right-click. You can right-click just about anything — a cell, a row or column border, a workbook title bar, a toolbar, and so on.

Smart Tags

A Smart Tag is a small icon that appears automatically in your worksheet after you complete certain actions. Clicking a Smart Tag reveals several clickable options.

For example, if you copy and paste a range of cells, Excel generates a Smart Tag that appears below the pasted range (see Figure 1-2). Excel features several other Smart Tags, and additional Smart Tags can be provided by third-party providers.

540734 fg0102.tif

Figure 1-2: This Smart Tag appears when you paste a copied range.

Task Pane

Excel 2002 introduced the task pane. This is a multi-purpose user interface element that is normally docked on the right side of Excel's window. The task pane is used for a variety of purposes, including displaying help topics, displaying the Office Clipboard, providing research assistance, and mapping XML data.

New_Icon.eps The task pane has been enhanced significantly in Excel 2003.

Dialog Boxes

Most of the menu commands in Excel display a dialog box in which you can clarify your intentions. In general, these dialog boxes are quite consistent in terms of how they operate. Some of Excel's dialog boxes use a notebook tab metaphor, which makes a single dialog box function as several different dialog boxes. Tabbed dialog boxes provide access to many options without overwhelming you. The Options dialog box (choose Tools ⇒ Options) presents an example of a tabbed dialog box in Excel 2003 (see Figure 1-3).

540734 fg0103.tif

Figure 1-3: The Options dialog box represents a type of tabbed dialog box.

Most of Excel's dialog boxes are modal dialog boxes. This means that you must close the dialog box in order to access your worksheet. A few, however, are stay on top dialog boxes. For example, the Find and Replace dialog box (accessible with Edit ⇒ Find) can remain open while you're working in a workbook.

Toolbars

Excel 2003 ships with dozens of predefined toolbars (including the two toolbars that function as menus). These toolbars typically appear automatically, when appropriate. For example, when you activate a chart, the Chart toolbar displays.

You can dock toolbars (position them along any edge of the screen) or make them float. By default, Excel displays the Standard and Formatting toolbars directly below the menu bar.

Drag-and-Drop

Excel's drag-and-drop UI feature enables you to freely drag objects that reside on the drawing layer to change their position. Pressing Ctrl while dragging duplicates the selected objects. These objects include AutoShapes, embedded charts, and diagrams.

Excel also permits drag-and-drop actions on cells and ranges. You can easily drag a cell or range to a different position. And pressing Ctrl while dragging copies the selected range.

Note_Icon.eps Cell drag-and-drop is optional; you can disable it in the Edit tab of the Options dialog box. Select Tools ⇒ Options to access the Options dialog box.

Keyboard Shortcuts

Excel has many keyboard shortcuts. For example, you can press Ctrl+C to copy a selection. If you're a newcomer to Excel or if you just want to improve your efficiency, then do yourself a favor and check out the shortcuts listed in Excel's Help system (search for Keyboard Shortcuts using the Type a question for help text box). The help system contains tables that summarize useful keyboard commands and shortcuts.

Customized On-screen Display

Excel offers a great deal of flexibility regarding on-screen display (status bar, formula bar, toolbars, and so on). For example, by choosing View ⇒ Full Screen, you can get rid of everything except the menu bar, thereby maximizing the amount of visible information. In addition, by using the View tab in the Options dialog box, you can customize what displays in a worksheet window (for example, you can hide scroll bars and grid lines).

Data Entry

Data entry in Excel is quite straightforward. Excel interprets each cell entry as one of the following:

• A value (including a date or a time)

• Text

• A Boolean value (TRUE or FALSE).

• A formula

Note_Icon.eps Formulas always begin with an equal sign (=).

Object and Cell Selecting

Generally, selecting objects in Excel conforms to standard Windows practices. You can select a range of cells by using the keyboard (using the Shift key, along with the arrow keys), or by clicking and dragging the mouse. To select a large range, click a cell at any corner of the range, scroll to the opposite corner of the range, and press Shift while you click the opposite corner cell.

Data-Entry Tips

The following list of data-entry tips can help those moving up to Excel from another spreadsheet:

• To enter data without pressing the arrow keys, enable the Move Selection After Enter option in the Edit tab of the Options dialog box (which you access from the Tools ⇒ Options command). You can also choose the direction that you want to go.

• You may find it helpful to select a range of cells before entering data. If you do so, you can use the Tab key to move only within the selected cells.

• To enter the same data in all cells within a range, select the range, enter the information into the active cell, and then press Ctrl+Enter.

• To copy the contents of the active cell to all other cells in a selected range, press F2 and then Ctrl+Enter.

• To fill a range with increments of a single value, press Ctrl while you drag the fill handle at the lower-right corner of the cell.

• To create a custom AutoFill list, use the Custom Lists tab of the Options dialog box.

• To copy a cell without incrementing, drag the fill handle at the lower-right corner of the selection; or press Ctrl+D to copy down or Ctrl+R to copy to the right.

• To make text easier to read, you can enter carriage returns in a cell. To enter a carriage return, press Alt+Enter. Carriage returns cause a cell's contents to wrap within the cell.

• To enter a fraction, enter 0, a space, and then the fraction (using a slash). Excel formats the cell using the Fraction number format.

• To automatically format a cell with the currency format, type your currency symbol before the value.

• To enter a value in percent format, type a percent sign after the value. You can also include your local thousand separator symbol to separate thousands (for example, 123,434).

• To insert the current date, press Ctrl+semicolon. To enter the current time into a cell, press Ctrl+Shift+semicolon.

• To set up a cell or range so that it only accepts entries of a certain type (or within a certain value range), use the Data ⇒ Validation command.

You can use Ctrl+* (Ctrl asterisk) to select an entire table. And when a large range is selected, you can use Ctrl+. (Ctrl period) to move among the four corners of the range.

Clicking an object placed on the drawing layer selects the object. An exception occurs if the object has a macro assigned to it. In such a case, clicking the object executes the macro. To select multiple objects or noncontiguous cells, press Ctrl while you select the objects or cells.

Excel's Help System

One of Excel's most important features is its Help system. When you get stuck, simply type some key words into the Type a question for help text box, which is located to the right of Excel's formula bar. A list of Help topics is displayed in the task pane. Click a topic, and the help text appears in a separate window (see Figure 1-4). There's a good chance that you'll find the answer to your question. At the very least, the Help system will steer you in the right direction.

540734 fg0104.tif

Figure 1-4: The task pane displays help topics, and the help text is displayed in a separate window.

New_Icon.eps Using the task pane to display help topics is new to Excel 2003.

If you are connected to the Internet, requests for help will search for updated help topics at Microsoft's Web site. To limit the help searches to your local system, select Offline Help from the Search drop-down list at the bottom of the task pane.

You may or may not have the Office Assistant installed. The Office Assistant is an animated character that serves as another interface to the Help system. Most people don't install this feature because it's extremely annoying.

Cell Formatting

Excel provides two types of cell formatting — numeric formatting and stylistic formatting.

Numeric Formatting

Numeric formatting refers to how a value appears in the cell. In addition to choosing from an extensive list of predefined formats, you can create your own custom number formats in the Number tab of the Format Cells dialog box (choose Format ⇒ Cells).

Excel applies some numeric formatting automatically, based on the entry. For example, if you precede a value with your local currency symbol (such as a dollar sign), Excel applies Currency number formatting.

Cross-Reference_Icon.eps Refer to Appendix C for additional information about creating custom number formats.

The number format doesn't affect the actual value stored in the cell. For example, suppose that a cell contains the value 3.14159. If you apply a format to display two decimal places, the number appears as 3.14. When you use the cell in a formula, however, the actual value (3.14159) — not the displayed value — is used.

Stylistic Formatting

Stylistic formatting refers to the cosmetic formatting (colors, shading, fonts, borders, and so on) that you apply in order to make your work look good. The Format Cells dialog box (see Figure 1-5) is your one-stop shopping place for formatting cells and ranges.

Many toolbar buttons offer direct access to common formatting options, regardless of whether you work with cells, drawn objects, or charts. For example, you can use the Fill Color toolbar button to change the background color of a selected cells, change the fill color of a drawn text box, or change the color of a bar in a chart. Access the Format dialog box for the full range of formatting options.

540734 fg0105.tif

Figure 1-5: Use the Format Cells dialog box to apply stylistic formatting.

Each type of object has its own Format dialog box. You can easily get to the correct dialog box and format an object by selecting the object, right-clicking, and then choosing Format xxx (where xxx is the selected object) from the shortcut menu. Alternatively, you can press Ctrl+1. Either of these actions leads to a tabbed dialog box that holds all the formatting options for the selected object.

Don't overlook Excel's conditional formatting feature. This handy tool enables you to specify formatting that appears only when certain conditions are met. For example, you can make the cell's interior red if the cell contains a negative number.

Cross-Reference_Icon.eps Chapter 19 describes how to create conditional formatting formulas that greatly enhance this feature.

Worksheet Formulas and Functions

Formulas, of course, make a spreadsheet a spreadsheet. Excel's formula-building capability is as good as it gets. You will discover this as you explore subsequent chapters in this book.

Worksheet functions allow you to perform calculations or operations that would otherwise be impossible. Excel provides a huge number of built-in functions, and you can access even more functions (many of them quite esoteric) by attaching the Analysis ToolPak add-in.

Cross-Reference_Icon.eps See Chapter 4 for more information about worksheet functions.

All spreadsheets allow you to define names for cells and ranges, but Excel handles names in some unique ways. A name represents an identifier that enables you to refer to a cell, range, value, or formula. Using names makes your formulas easier to create and read.

Cross-Reference_Icon.eps I devote Chapter 3 entirely to names.

Objects on the Drawing Layer

As I mentioned earlier in this chapter, each worksheet has an invisible drawing layer, which holds shapes, diagrams, charts, pictures, and controls (such as buttons and list boxes). I discuss some of these items in the following sections.

Shapes

You can insert AutoShapes from the Drawing toolbar. You can choose from a huge assortment of shapes. After you place a shape on your worksheet, you can modify the shape by selecting it and dragging its handles. In addition, you can apply drop shadows, text, or 3-D effects to the shape. Also, you can group multiple shapes into a single drawing object, which you'll find easier to size or position.

Diagrams

The Insert ⇒ Diagram command displays the Diagram Gallery dialog box, shown in Figure 1-6. You can choose from six diagrams, and each is highly customizable.

Linked Picture Objects

For some reason, the designers of Excel make the linked picture object rather difficult to generate. To use this object, copy a range and then press Shift and select the Edit ⇒ Paste Picture Link command (which appears on the Edit menu only when you press Shift). This command originally accommodated users who wanted to print a noncontiguous selection of ranges. Users could take pictures of the ranges and then paste the pictures together in a single area, which they could then print.

540734 fg0106.tif

Figure 1-6: Excel supports several types of diagrams.

Dialog Box Controls

Many of the controls that are used in custom dialog boxes can be placed directly on the drawing layer of a worksheet. Doing this can greatly enhance the usability of some worksheets and eliminate the need to create custom dialog boxes. Figure 1-7 shows a worksheet with some dialog box controls added to the drawing layer.

Note_Icon.eps Dialog box controls come from two sources: The Forms toolbar, or the Control Toolbox toolbar. Controls from the Control Toolbox toolbar consist of ActiveX controls, and are available only in Excel 97 or later.

540734 fg0107.tif

Figure 1-7: Excel enables you to add many controls directly to the drawing layer of a worksheet.

Charts

Excel, of course, has excellent charting capabilities. As I mentioned earlier in this chapter, you can store charts on a chart sheet or you can float them on a worksheet.

Excel offers extensive chart customization options. If a chart is free-floating, just click a chart element to select it (or double-click it to display its Format dialog box). Right-clicking a chart element displays a shortcut menu.

You can easily create a free-floating chart by selecting the data to be charted and then using the Chart Wizard to walk you through the steps to create a chart that meets your needs.

Cross-Reference_Icon.eps Chapter 17 contains additional information about charts.

Customization in Excel

This section describes various features that enable you to customize Excel. They include macros, toolbars, and add-in programs.

Macros

Excel's VBA programming language provides a powerful tool that can make Excel perform otherwise impossible feats. You can classify the procedures that you create with VBA into two general types:

• Macros that automate various aspects of Excel.

• Macros that serve as custom functions that you can use in worksheet formulas.

Cross-Reference_Icon.eps Part VI of this book describes how to use and create custom worksheet functions using VBA.

Toolbars

As I noted earlier, Excel includes many toolbars. You can, if you're so inclined, create new toolbars that contain existing toolbar buttons, or new buttons that execute macros.

Use the View ⇒ Toolbars ⇒ Customize command to customize toolbars or create new ones. You can also write VBA code to manipulate toolbars.

Add-in Programs

An add-in is a program attached to Excel that gives it additional functionality. For example, you can store custom worksheet functions in an add-in. To attach an add-in, use the Tools ⇒ Add-Ins command.

Excel ships with quite a few add-ins (including the Analysis ToolPak). In addition to these add-ins, you can purchase or download many third-party add-ins from online services. My Power Utility Pak represents an example of an add-in. You can access a trial version on the CD-ROM included with this book.

Cross-Reference_Icon.eps Chapter 23 describes how to create your own add-ins that contain custom worksheet functions.

Analysis Tools

Excel is certainly no slouch when it comes to analysis. After all, most people use a spreadsheet for analysis. Many analysis tasks can be handled with formulas, but Excel offers many other options, which I discuss in the following sections.

Database Access

Over the years, most spreadsheets have enabled users to work with simple flat database tables (even the original version of 1-2-3 contained this feature). Excel's database features fall into two main categories:

Worksheet databases. The entire database stores in a worksheet, limiting the size of the database. In Excel, a worksheet database can have no more than 65,535 records (because there are 65,536 rows; the top row holds the field names) and 256 fields (because there are 256 columns).

External databases. The data stores in one or more disk files and you can access it as needed.

Generally, when the cell pointer resides within a worksheet database, Excel recognizes it and displays the field names whenever possible. For example, if you move the cell pointer within a worksheet database and choose the Data ⇒ Sort command, Excel enables you to select the sort keys by choosing field names from a drop-down list.

A particularly useful feature, Excel's AutoFilter, enables you to display only the records that you want to see. When AutoFilter mode is on, you can filter the data by selecting values from pull-down lists (which appear in place of the field names when you choose the Data ⇒ Filter ⇒ AutoFilter command). Rows that don't qualify are temporarily hidden. See Figure 1-8 for an example.

540734 fg0108.tif

Figure 1-8: Excel's AutoFilter feature makes it easy to view only the database records that meet your criteria.

If you prefer, you can use the traditional spreadsheet database techniques that involve criteria ranges. To do so, choose the Data ⇒ Filter ⇒ Advanced Filter command.

Cross-Reference_Icon.eps Chapter 9 provides additional details regarding worksheet lists and databases.

Excel can automatically insert (or remove) subtotal formulas in a table that is set up as a database. It also creates an outline from the data so that you can view only the subtotals, or any level of detail that you desire.

Outlines

A worksheet outline often serves as an excellent way to work with hierarchical data, such as budgets. Excel can create an outline automatically by examining the formulas in your worksheet (use the Data ⇒ Group and Outline command). After you've created an outline, you can collapse or expand the outline to display various levels of details. Figure 1-9 shows an example of a worksheet outline.

540734 fg0109.tif

Figure 1-9: Excel can automatically insert subtotal formulas and create outlines.

Scenario Management

Scenario management is the process of storing input values that drive a model. For example, if you have a sales forecast, you may create scenarios such as best case, worst case, and most likely case.

If you seek the ultimate in scenario-management features, 1-2-3's Version Manager is probably your best bet. Unlike Version Manager, Excel's Scenario Manager can only handle simple scenario-management tasks. However, it is definitely easier than trying to keep track of different scenarios manually.

Analysis ToolPak

The Analysis ToolPak add-in provides 19 special-purpose analysis tools (primarily statistical in nature) and many specialized worksheet functions. These tools make Excel suitable for small- to medium-scale statistical analysis.

Pivot Tables

One of Excel's most powerful tools is its pivot tables. A pivot table enables you to display summarized data in just about any possible way. Data for a pivot table comes from a worksheet database or an external database and stores in a special cache, which enables Excel to recalculate data rapidly after a pivot table is altered.

Cross-Reference_Icon.eps Chapter 18 contains additional information about pivot tables.

Excel 2000 and later versions also support the pivot chart feature. Pivot charts enable you to link a chart to a pivot table.

Auditing Capabilities

Excel also offers useful auditing capabilities that help you identify errors or track the logic in an unfamiliar spreadsheet. To access this feature, select Tools ⇒ Formula Auditing.

Solver Add-in

For specialized linear and nonlinear problems, Excel's Solver add-in calculates solutions to what-if scenarios based on adjustable cells, constraint cells, and, optionally, cells that must be maximized or minimized.

Protection Options

Excel offers a number of different protection options. For example, you can protect formulas from being overwritten or modified, protect a workbook's structure, and protect your VBA code.

Protecting Formulas from Being Overwritten

In many cases, you may want to protect your formulas from being overwritten or modified. To do so, perform the following steps:

1. Select the cells that may be overwritten.

2. Select Format ⇒ Cells, and click the Protection tab of the Format Cells dialog box.

3. In the Protection tab, remove the check mark from the Locked check box.

4. Click OK to close the Format Cells dialog box.

5. Select Tools ⇒ Protection ⇒ Protect Sheet to display the Protect Sheet dialog box, as shown in Figure 1-10. If you use a version prior to Excel 2002, this dialog box looks different.

6. In the Protect Sheet dialog box, specify a password if desired, and click OK.

Note_Icon.eps By default, all cells are locked. This has no effect, however, unless you have a protected worksheet.

Beginning with Excel 2002, Excel's protection options have become much more flexible. When you protect a worksheet, the Protect Sheet dialog box lets you choose which elements won't be protected. For example, you can allow users to sort data or use AutoFiltering on a protected sheet (tasks that weren't possible with earlier versions).

540734 fg0110.tif

Figure 1-10: Choose which elements to protect in the Protect Sheet dialog box.

You can also hide your formulas so they won't appear in Excel's formula bar when the cell is activated. To do so, select the formula cells and make sure that the Hidden check box is checked in the Protection tab of the Format Cells dialog box.

Protecting a Workbook's Structure

When you protect a workbook's structure, you can't add or delete sheets. Use the Tools ⇒ Protection ⇒ Protect Workbook command to display the Protect Workbook dialog box, as shown in Figure 1-11. Make sure that you check the Structure check box. If you also check the Windows check box, the window can't be moved or resized.

540734 fg0111.tif

Figure 1-11: The Protect Workbook dialog box.

Caution_Icon.eps It's important to keep in mind that Excel is not really a secure application. The protection features, even when used with a password, are intended to prevent casual users from accessing various components of your workbook. Anyone who really wants to defeat your protection can probably do so by using readily available password-cracking utilities.

Summary

This chapter provides a general overview of the features available in Excel, and primarily focuses on newcomers to Excel. The next chapter gets into the meat of the book and provides an introduction to Excel formulas.

Chapter 2: Basic Facts about Formulas

In This Chapter

How to enter, edit, and paste names into formulas

The various operators used in formulas

How Excel calculates formulas

Cell and range references used in formulas

How to make an exact copy of a formula

How to convert formulas to values

How to prevent formulas from being viewed

The types of formula errors

Circular reference messages and correction techniques

Excel's goal-seeking feature

This chapter serves as a basic introduction to using formulas in Excel. Although I direct its focus on newcomers to Excel, even veteran Excel users may find some new information here.

Entering and Editing Formulas

This section describes the basic elements of a formula. It also explains various ways of entering and editing your formulas.

Formula Elements

A formula entered into a cell can consist of five element types:

Operators: These include symbols such as + (for addition) and * (for multiplication).

Cell references: These include named cells and ranges and can refer to cells in the current worksheet, cells in another worksheet in the same workbook, or even cells in a worksheet in another workbook.

Values or strings: Examples include 7.5 or Year-End Results.

Worksheet functions and their arguments: These include functions such as SUM or AVERAGE and their arguments.

Parentheses: These control the order in which expressions within a formula are evaluated.

Entering a Formula

When you type an equal sign into an empty cell, Excel assumes that you are entering a formula (a formula always begins with an equal sign). Excel's accommodating nature also permits you to begin your formula with a minus sign or a plus sign. However, Excel always inserts the leading equal sign after you enter the formula.

As a concession to former 1-2-3 users, Excel also enables you to use an at symbol (@) to begin a formula that starts with a function. For example, Excel accepts either of the following formulas:

=SUM(A1:A200)

@SUM(A1:A200)

However, after you enter the second formula, Excel replaces the at symbol with an equal sign. You can enter a formula into a cell in one of two ways: enter it manually, or enter it by pointing to cell references. I discuss each of these methods in the following sections.

Entering Formulas Manually

Entering a formula manually involves, well, entering a formula manually. You simply activate a cell and type an equal sign (=) followed by the formula. As you type, the characters appear in the cell as well as in the formula bar. You can, of course, use all the normal editing keys when entering a formula. After you insert the formula, press Enter.

Note Icon.eps When you enter an array formula, you must press Ctrl+Shift+Enter rather than just Enter. I discuss array formulas in Part IV.

After you press Enter, the cell displays the result of the formula. The formula itself appears in the formula bar when the cell is activated.

Entering Formulas by Pointing

The other method of entering a formula still involves some manual typing, but you can simply point to the cell references instead of entering them manually. For example, to enter the formula =A1+A2 into cell A3, follow these steps:

1. Move the cell pointer to cell A3.

2. Type an equal sign (=) to begin the formula. Notice that Excel displays Enter in the left side of the status bar.

3. Press the up arrow twice. As you press this key, notice that Excel displays a faint moving border around the cell and that the cell reference (A1) appears in cell A3 and in the formula bar. Also notice that Excel displays Point in the status bar.

If you prefer, you can use your mouse and click cell A1.

4. Type a plus sign (+). The faint border disappears and Enter reappears in the status bar. The cell cursor also returns to the original cell (A3).

5. Press the up arrow one more time. A2 adds to the formula.

If you prefer, you can use your mouse and click cell A2.

6. Press Enter to end the formula. As with entering the formula manually, the cell displays the result of the formula, and the formula appears in the formula bar when the cell is activated.

If you prefer, you can use your mouse and click the check mark icon next to the formula bar.

Pointing to cell addresses rather than entering them manually is usually less tedious, and almost always more accurate.

Note Icon.eps If you create a formula in a cell that hasn't been formatted with a number format, the cell that contains the formula will take on the same number format as the first cell to which it refers. An exception to this is when the first cell reference is formatted as a percentage. In this case, the formula cell uses the formatting from the second referenced cell.

Pasting Names

As I discuss in Chapter 3, you can assign a name to a cell or range. If your formula uses named cells or ranges, you can type the name in place of the address or choose the name from a list and have Excel insert the name for you automatically.

To insert a name into a formula, select the Insert⇒Name⇒Paste command (or Press F3) to display the Paste Name dialog box. Excel displays its Paste Name dialog box with all the names listed, as shown in Figure 2-1. Select the name and click OK. Or you can double-click the name, which inserts the name into the formula and closes the dialog box.

540734 fg0201.tif

Figure 2-1: The Paste Name dialog box enables you to insert a name while entering a formula.

Spaces and Line Breaks

Normally, you enter a formula without using any spaces. However, you can use spaces (and even line breaks) within your formulas. Doing so has no effect on the formula's result, but may make the formula easier to read. To enter a line break in a formula, press Alt+Enter. Figure 2-2 shows a formula that contains spaces and line breaks.

540734 fg0202.tif

Figure 2-2: This formula contains spaces and line breaks.

Formula Limits

A formula can consist of up to 1,024 characters. If you need to create a formula that exceeds this limit, you must break the formula up into multiple formulas. You also can opt to create a custom function (using VBA).

Cross-Reference Icon.eps Part IV focuses on creating custom functions.

Sample Formulas

If you follow the above instructions for entering formulas, you can create a variety of formulas. This section provides a look at some sample formulas.

• The following formula multiplies 150 times .01, and returns 1.5. This formula uses only literal values, so it doesn't prove very useful (you can simply enter the value 1.5 instead of the formula).

=150*.01

• This formula adds the values in cells A1 and A2:

=A1+A2

• The next formula subtracts the value in the cell named Expenses from the value in the cell named Income.

=Income–Expenses

• The following formula uses the SUM function to add the values in the range A1:A12.

=SUM(A1:A12)

• The next formula compares cell A1 with cell C12 by using the = operator. If the values in the two cells are identical, the formula returns TRUE; otherwise it returns FALSE.

=A1=C12

• This final formula subtracts the value in cell B3 from the value in cell B2 and then multiplies the result by the value in cell B4:

=(B2-B3)*B4

Editing Formulas

If you make changes to your worksheet, you may need to edit formulas. Or the formula may return one of the error values described later in this chapter, and you need to edit the formula to correct the error. You can edit your formulas just as you edit any other cell.

There are several ways to get into cell edit mode:

1. Double-click the cell. This enables you to edit the cell contents directly in the cell. This technique works only if the Edit Directly in Cell option is in effect. You can change this option in the Edit tab of the Options dialog box.

2. Press F2. This enables you to edit the cell contents directly in the cell. If the Edit Directly in Cell option is not turned on, the editing will occur in the formula bar.

3. Select the formula cell that you want to edit and then click in the formula bar. This enables you to edit the cell contents in the formula bar.

When you edit a formula, you can select multiple characters by dragging the mouse over them or by holding down Shift while you use the arrow keys. You can also press Home or End to select from the cursor position to the beginning or end of the formula. If you use Ctrl+Shift, pressing the arrow keys allows you to select words within the formula.

Using the Formula Bar as a Calculator

If you simply need to perform a calculation, you can use the formula bar as a calculator. For example, enter the following formula into any cell:

=(145*1.05)/12

Because this formula always returns the same result, you might prefer to store the formula's result rather than the formula. To do so, press F2 to edit the cell. Then press F9 followed by Enter. Excel stores the formula's result (12.6875), rather than the formula. This technique also works if the formula uses cell references.

You'll find that this technique is most useful when you use worksheet functions. For example, to enter the square root of 221 into a cell, enter =SQRT(221), press F9, and press Enter. Excel enters the result: 14.8660687473185. You also can use this technique to evaluate just part of a formula. Consider this formula:

=(145*1.05)/A1

If you want to convert just the expression within the parentheses to a value, get into cell edit mode and select the part that you want to evaluate. In this example, select 145*1.05. Then press F9 followed by Enter. Excel converts the formula to the following:

=(152.25)/A1

Tip Icon.eps Suppose you have a lengthy formula that contains an error, and Excel won't let you enter it because of the error. In this case, you can convert the formula to text and tackle it again later. To convert a formula to text, just remove the initial equal sign (=). To try the formula again, insert the initial equal sign to convert the cell contents back to a formula.

Using Operators in Formulas

As previously discussed, an operator is the basic element of a formula. An operator is a symbol that represents an operation. Excel supports the following operators:

MT 2-1a

You can, of course, use as many operators as you need. Formulas can prove quite complex.

Reference Operators

Excel supports another class of operators known as reference operators. Reference operators, described in the following list, work with cell references.

MT 2-1b

Sample Formulas That Use Operators

These examples of formulas use various operators:

• The following formula joins (concatenates) the two literal text strings (each enclosed in quotes) to produce a new text string: Part-23A:

=Part-&23A

• The next formula concatenates the contents of cell A1 with cell A2:

=A1&A2

Usually, concatenation is used with text, but concatenation works with values as well. For example, if cell A1 contains 123 and cell A2 contains 456, the preceding formula would return the value 123456. Note that, technically, the result is a text string. However, this text string functions as a numeric value, and it can

Enjoying the preview?
Page 1 of 1