beginning microsoft excel 2010 phần 7 doc

40 333 0
beginning microsoft excel 2010 phần 7 doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 226 ■ Note also the Table Name: field in the Properties button group. It displays a default name for the table, which you change by typing a different one and then simply clicking elsewhere. At the Risk of Repeating Yourself: The Remove Duplicates Option One classic data entry bugaboo is the risk of entering the same name twice. Working with long, multiple lists of names—some of which you may have inherited from other sources—could well result in name duplication, and while you may know that the three John Does in your database are the same person, Excel won’t. Hence the Remove Duplicates table option in the Tools button group. It’s a good one to know, provided you know exactly how it works. Note in addition that this feature also works on a range of data that has not been submitted to the Insert Table command. For non-table ranges you can click: Data Ribbon  Remove Duplicates, on the Data Tools button. The command searches for identical values or text in a particular table field or fields and if it finds any, deletes all rows containing that value—except for the first instance of that value, which it leaves in place. Thus if your table has data such as these (Figure 6–44): Figure 6–45. Not-quite-duplicate names and you launch a Remove Duplicates search of the Last Name field, the row containing Grace Jones’ record will be deleted—and that not may be what you had in mind, because Grace Jones is obviously not a mere duplicate of Ed Jones. She’s a different person. What you’d presumably want to do then, is eliminate all duplicates of Ed Jones—and if that’s your objective, you’d need to search for duplicates in both the Last and First Name fields at the same time. So let’s go with this example, and this simple collection of names, which contains an obvious duplicate record. In cells L14:N20, type these data, and execute the Insert Table command (Figure 6–45). The format you choose doesn’t matter: CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 227 Last Name First Name Age Jones Ed 34 Walters Gary 21 Jones Ed 34 Albert Ida 26 Troy Helen 51 Jones Grace 42 Figure 6–46. Broken record: Two Ed Joneses You added the Age field, because there could well be two persons in the database named Ed Jones—with different ages. Then click anywhere in the table and click Remove Duplicates on the Tools Button group. You’ll see (Figure 6–46): Figure 6–47. Duplication search criteria Note that by default all three fields are checked, meaning: if we click OK, Excel will remove only those records which contain duplicate data in all three fields. It’s clear in our table that the two records of Ed Jones are indeed identical across all three. Click OK, and you’ll see (Figure 6–47): CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 228 Figure 6–48. Results reported OK—“1 duplicate values” isn’t grammatically correct (let’s not be too harsh—Bill Gates did drop out of Harvard, after all), but you get the idea. The second Ed Jones has been removed—but had Ed Jones Number 2 been say, 37 years old, he’d have remained in the table, because his three fields would no longer completely duplicate those of Ed Jones the First. And Grace Jones has been completely ignored by our duplicate removal, as she should be—because only her last name duplicates the other Joneses, and again, we required a match on all three fields. Thus if you really wanted the table to display just one record containing Jones, you’d click First Name and Age off in the Remove Duplicates dialog box, thus confining your search to duplicates in Last Name only—a less restrictive criterion. Finally, to turn off the table’s status as a table, should you want to do such a thing, click anywhere in the table and then click Table Tools  Convert to Range on the Tools button group. A prompt appears, asking: “Do you want to convert the table to a normal range?” Clicking Yes turns off the AutoFilter, but leaves your current table formatting in place, along with the Total row and any SUBTOTAL calculations you’ve added (though it does subtly rewrite the SUBTOTAL formulas), by substituting the range being subtotaled (i.e., $I$10:$I$19) for the name of the field (i.e., Average) whose data are subject to the subtotal. Data Validation: Improving Your Entrée to Data Entry Whether you’re an Excel guru or an Excel tyro, your worksheets are only as good as the quality of the data you post to them. The most elegant formulas and beauteous charts in all of Exceldom won’t work if the data they crunch are erroneous, and Excel provides you with a collection of ways for preempting— though not completely preventing—miscues in data entry. One such collection is warehoused in the Data Validation option, which you can access via the Data  Data Tools ribbon group. Data Validation offers you an assortment of what are, for the most part, pretty simple ways to restrict the kinds of data you can enter in any range (no table required), and thus minimize the likelihood of entering the wrong numbers, or even the wrong text. Using Data Validation Let’s demonstrate how Data Validation works with a simple introductory example. Suppose you need to enter state names as per their post office designations—that is, their two-lettered abbreviations. 1. Select any range and then click the Data Validation button. Its dialog box appears 2. Click the drop-down arrow by Allow. You’ll see (Figure 6–48): CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 229 Figure 6–49. The Data Validation drop-down menu 3. Click Text length, and this set of fields appears (Figure 6–49): Figure 6–50. Limiting text length in selected cells. Sounds like Twitter. 4. Click the Data down arrow and a series of operators—greater than, less than, equal to, between, etc., appears. 5. Click on equal to (Figure 6–50): CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 230 Figure 6–51. Rather taciturn: A two-character data entry limit 6. Enter 2 in the Length field. 7. Click OK. What we’ve done here is specify a character-entry limit of 2 for any cell in the range we selected. That means you’ll only be able to enter exactly 2 characters, no more and no less (and that rule does allow exactly two-digit numbers), in those cells—and that’s what we want, since we need to insure that we enter the two-character state abbreviations only and be prevented from accidentally entering expressions of any other length. If, then, we inadvertently attempt to enter CAL for California in any cell in the range, we’ll trigger this error message (Figure 6–51): Figure 6–52. Nice try: Can’t fool Data Validation! because CAL is three characters. When we retry and type CA, the entry will be accepted. That’s what Data Validation does: enable the user to establish rules to prevent certain kinds of unwanted data entry. It can’t, of course, prevent you from entering NY when you wanted to type AZ, because both expressions meet the two-character requirement here, but it will fend off CAL and C, for that matter. CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 231 Adding Data Entry Rules The Data Validation Allow field lets you to install a data entry rule, with the same Data drop-down operators (greater than, equal to, etc.) for these data types: • Any Value—which really institutes no restriction • Whole number—allows you to restrict data entry via the operators to whole numbers alone, e.g., numbers between 10 and 20. Here you’d be able to enter 12 or 17, but not 17.6. • Decimal—allowing you to restrict data entry via the operators that permit decimal entry. Thus if the rule restricted entry to values between 10 and 20, you’d be able to enter 12 and 17 as well as 17.6—but not 34 or 34.1, as both exceed 20. • Date—allows you to restrict data entry via the operators to dates equaling a particular date, or to a dates falling between two dates, etc. • Time—allows you to restrict data entry via the operators to times, such as between 10:00 and 12:00, etc. • Text Length—as discussed. There are two additional Data Validation Allow options, List and Custom. List is a rather neat feature, giving you the option to construct a drop-down menu of data entry choices. To explain: suppose I want to be able to enter the names of any of my five salespersons down a range, say A1:A20, by selecting these from a drop-down menu. 1. First, enter the salesperson names in any range, e.g., P19:P23 (Figure 6–52): Figure 6–53. These names will appear in your customized drop-down menu, or list. 2. Then select A1:A20. 3. Then click Data Validation  Allow  List. You’ll see: (Figure 6–53): CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 232 Figure 6–54. Menu venue: Where the drop-down list is constructed 1. In the Source field type or drag this range: P19:P23, the range containing the salesperson names to populate the drop-down menu. 2. Click OK. Click on cell A1 and a drop-down arrow appears. Click it and you’ll see (Figure 6–54): Figure 6–55. There’s your list Just click any name and it’ll enter the cell. This, too, is an instance of Data Validation—because it serves as a means for restricting the data entry to the names in the drop-down. Try typing any other name in A1:A20, and you’ll encounter the same error message we saw earlier. Note: you can also enter the salesperson names directly in the Source Field, each name separated by a comma. In this way, too, the names will populate the drop-down menu. The Ignore Blank option, the source of considerable confusion on Internet group posts, here means: if you’ve entered a Source range by its range name (if it has one), and some of the cells in that range are blank, leaving Ignore blank on means you’ll still be able to enter data that isn’t in the Source range list. Turning Ignore blank off here will obstruct any data not listed in the Source range. Thus if your list looks like this (Figure 6—55): CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 233 Figure 6–56. Blank look: A list with empty, blank rows the resulting drop-down list will display that blank space, and you won’t be able to enter names other than the ones you see in the list. Leave Ignore blank on, and you will be able to. It’s a rather strange option. The Custom option allows you to establish a data entry rule based on a formula. For example, if you’re grading an exam for which you’ve established a highest possible grade of 50, and you want to prevent yourself from absent-mindedly entering higher scores in student records, you can: 1. Enter the 50 in a cell, say A6. 2. Then, assuming you’re entering the grades in cells B5:B20, select that range, making sure the range remains selected. 3. Then click Data Validation  Data Validation  Settings  Custom. 4. Make sure the current cell in the selected range is B5 (by way of review, that’s the cell in white). 5. Type =B5=A$6 in the Formula field (Figure 6–56): Figure 6–57. Customizing a data validation rule 6. Click OK. CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 234 What this formula does is restrict the data entry in B5:B20 to a value no greater than the number you’ve posted in A6, in this case 50. Change that highest-possible-grade value in A6, and your data entry limit for B5:B20 changes accordingly. The formula requires the dollar sign before the 6 in A6, because even though the formula is initially written in cell B5, because you’ve selected the range B5:B20, Data Validation copies this formula to the other cells in the range; and because of relative cell referencing, the A6 would otherwise revert to A7, A8, A9, etc. down the range. But we need to hold to A6 throughout the range—because that’s where the grade value is stored. Adding an Input Message Data Validation also allows you to fashion a prompt, called an Input Message, which appears over the cell in which you’re about to enter data, informing the user what sort of data can be entered in the cell as per your data validation rule. To demonstrate by returning to the two-character state name data validation rule, we can: 1. Select any range, say H3:H40. Leave the range selected. 2. Click Data Validation  Data Validation  Allow  Text Length  Data and select “equal to” on the drop-down menu. 3. Enter 2 in the Length field. 4. Click the Input Message tab. 5. In the Title field enter 2 Characters, Please (or any suitable title.) 6. In the Input Message field, type: You Must Enter a Two-Character State Abbreviation. 7. Click OK. Rest your mouse over any cell in the H3:H40 range. You should see (Figure 6–57): Figure 6–58. An Input Message Using the Error Alert Option And there’s another option you can implement with Data Validation, which enables you to modify the restrictions on data entry in cells—the Error Alert option. Error Alert does more than simply alert the user about various validations; it also lets you notify the user about a restriction—and then allows the restricted data to be entered anyway. 1. Select cells H3:H40 again, and select Data Validation  Data Validation  Error Alert. CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 235 2. You’ll see a drop-Down menu entitled Style that stores three options. The first is Stop, the Data Validation default whose error message is the one we’ve already seen. The second is called Warning. Select it and another Title/Error Message set of fields appears, enabling you to type whatever customized prompts you wish. But when selected, Warning allows the user to go ahead and enter data even if it violates the data validation rule. If I choose the Warning option for range H3:H40, and then type CAL in H3, this default message appears (Figure 6–58): Figure 6–59. Don’t say we didn’t warn you: Overriding the restriction, if you wish 3. If I click Yes, CAL will be accepted anyway. 4. The third prompt, Information, works just slightly differently. It too allows you to proceed with data entry that violates the data validation rule, but its default message simply notifies the user of the violation, without asking if he/she wants to continue. Here clicking OK automatically accepts the data (Figure 6–59): Figure 6–60. An information message prompt: Not as informative as the previous warning Again, all three Error Alert possibilities allow you to customize your own prompts, affording you the opportunity to indulge in some gentle and prudent office humor, such as this (Figure 6–60): [...]... (Figure 7 17) : 254 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS Figure 7 17 Heading toward the Protection tab in the Format Cells dialog box Déjà vu? We’re back to a dialog box we’ve seen a few million times before in previous chapters, but here you need to click the Protection tab, something we haven’t yet done Click it and you’ll see (Figure 7 18): Figure 7 18 Protection options—read with care 255 CHAPTER 7. .. Add You’ll see (Figure 7 27) : Figure 7 27 Identifying the first range to be consolidated Then click sheet 2009, select cells B5:B8, click Add, and do the same for sheet 2010 (Note that when you click on sheets 2009 and 2010 you should find that B5:B8 is already selected If not, just drag those cells.) Then click OK in the above dialog box You should see (Figure 7 28): Figure 7 28 The consolidation—you’re... the password option featured in the Protect Sheet dialog box (Figure 7 21): Figure 7 21 The password protection option 2 57 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS Entering a password prevents you—or anyone else—from unprotecting the sheet Once you type a password—which is optional—another dialog box appears (Figure 7 22): Figure 7 22 The password confirmation prompt Protect the password, too Note... (see below in figure 7 15) to lock that cell back along with the rest of the sheet There is, however, another command out there—an alternative way to unlock cells before you protect a sheet—that may rank among Excel s most puzzling If we return to the Cells Format dropdown menu, you’ll see another Lock Cell option (Figure 7 20): 256 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS Figure 7 20 Don’t be boggled... prove its point Just watch Type 71 in cell D18 on Sheet1 Then type 21 in cell A2 in Sheet2 Return to Sheet1, and write the following formula in E 17: =D18+Sheet2!A2 Answer: 92 OK—been there, done that, got the t-shirt But now click back onto Sheet2, and click Formulas Watch Window You’ll see (Figure 7 13): Figure 7 13 Opaque window—watching designated cells 251 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS... drop-down menus and the like Good things to know—and there’s more to come 2 37 CHAPTER 6 ■ SETTING THE TABLE: DATABASE FEATURES OF EXCEL 2010 238 CHAPTER 7 ■■■ Working With Multiple Sheets A worksheet is a spacious place–16 billion or so cells at your disposal, each one accessible in a flash at the tap of a keyboard The Name Box is your Excel based satnav; type any address therein and the Box doesn’t tell... suggesting you could select a range If you do, each cell in the range appears in the Watch Window, along with its value.) Then Click Add You should see (Figure 7 15): Figure 7 15 The current result for cell E 17 in Book3, Sheet1 252 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS Note the dialog box records the workbook name as well as the sheet in which our watched cell is positioned; that tells you that... (Figure 7 4): Figure 7 4 Outta sight: where to start hiding rows or columns 242 CHAPTER 7 ■ WORKING WITH MULTIPLE SHEETS Click and the rows or columns will disappear, as will the column letters and/or row numbers of the hidden items To hide several rows or columns at the same time, just drag across those columns or drag down those rows, leave that selection in place, and click the commands you see in 7 4... encounter this error message (Figure 7 19): Figure 7 19 Locked out of a cell without a key—the protection error message Unlocking Cells The prompt in Figure 7 19 informs you of one—but only one—way of returning the entire worksheet back to normal data entry status, or its unprotected state: Review tab Unprotect Sheet, in the Changes button group (another lovely Excel “un” verb) There’s an alternative... (Figure 7 6): Figure 7 6 One way in which to insert a new worksheet • Click Insert….In the Insert dialog box The new worksheet will be selected by default Click OK The new sheet appears, bearing the default name Sheet4, if it’s the first new sheet you’ve inserted And there’s a still easier way to insert a new sheet Click the Insert Worksheet button to the immediate right of the worksheet tabs (Figure 7 7) : . Rows instead. Thus if you click in row 17, you’ll insert a new row above the original 17 which becomes the “new” row 17, whilst the original row 17 is now bumped to 18. To insert multiple. Click the Insert Worksheet button to the immediate right of the worksheet tabs (Figure 7 7) : Figure 7 7. And here’s another Note the keyboard equivalent, too—Shift-F11. Clicking Insert Worksheet. Whether you’re an Excel guru or an Excel tyro, your worksheets are only as good as the quality of the data you post to them. The most elegant formulas and beauteous charts in all of Exceldom won’t

Ngày đăng: 14/08/2014, 09:20

Mục lục

  • Setting the Table: Database Features of Excel 2010

    • At the Risk of Repeating Yourself: The Remove Duplicates Option

    • Data Validation: Improving Your Entrée to Data Entry

      • Using Data Validation

      • Adding Data Entry Rules

      • Adding an Input Message

      • Using the Error Alert Option

      • Adding a Validation Rule to Existing Data

      • Working With Multiple Sheets

        • Adding To Sheets—Inserting Rows, Columns and Cells

          • Inserting a Column

          • Deleting Rows and Columns

          • Inserting and Deleting Cells

          • Rows and Columns—and Getting them Back

          • Multiple Worksheet Basics

            • Inserting a New Worksheet

            • Busting a (Sheet) Move

            • Far-Flung Formulas: Working with Multi-Sheet Cell References

              • Doing a Multi-sheet Calculation

              • Extending Your Reach: Referring to Cells in Different Workbooks

              • The Watch Window—Spying On Your Own Data

              • Protect Your Cells From Unwanted Intruders—Even Yourself

                • Protecting a Sheet

                • Protecting a Whole Workbook

                • Consolidating Your Data—Getting It All Together

                • PivotTables and Pivot Charts

                  • Starting Out with PivotTables

Tài liệu cùng người dùng

Tài liệu liên quan