|
Names Tutorial H: Useful conventions |
This page in 2007 Top Previous Next |
|
Problem To get started with this lesson, load the example spreadsheet Names tutorial H Conventions with names.xls.
We'd like to give names to the different lines of numbers. How shall we do it?
If we highlight cells A1:G13, and use the Insert | Name | Create command specifying that the names are to be taken from the labels in the left column, we will give the name Revenue to row 3, and Costs to row 9. But those lines have no numbers on them, while the lines that do have numbers remain unnamed. So that's not much good.
The reason is that Excel works down the selected rows, allocating the name dog to row 4, cat to row 5, fish to row 6 and parrot to row 7. Then it gets to row 10, and finds that it is being asked to allocate the the name dog again. At this point it pauses for instructions. Depending on the answer to Excel's question, the name dog will be associated with rows 4 or 10; but not both. One line will go unnamed. The same is true for the other three names on offer.
Solution One recommendable way forward is to put the intended names down the right side of the spreadsheet.
Then we can select cells C4:H13 (the numbers plus the labels on the right) and use Insert | Name | Create, this time in the right column.
By devoting the right side of the spreadsheet to names, we attain a layout that is self documenting (what a row is called is written at its right side) and allows the names to be created in a single action. At the same time the left side can be arranged to make the purpose of the spreadsheet clear to human readers, without any of the compromise that would be needed if the two functions were merged, as they were in steps 1 and 2 above. choice of names Remember those shortcuts we learned early on? F5 is Goto; F3 is for pasting names into a formula more accurately than one can type them. And we've also met Apply names. Every one of these commands lists the names in a workbook in alphabetical order. The convention Operis follows is that names are chosen so that related items are near each other in these sorted lists. So here, we have four kinds of Costs, and by calling them CostsDogs, CostsCats and so on, we ensure that they are to be found by each other when presented alphabetically. The noun (Revenue or Costs) goes first, then the qualifier (Dogs, Cats etc). It's a bit like the French preference to put adjectives after nouns (La Maison Blanche) in contrast with the opposite order in English (The White House). Whether you follow this convention or another, the valuable thing is that you have one, and that it is followed by all members of a team that has to work on each other's spreadsheets. Summary If you name a cell or a range of cells, document the fact in a cell nearby. Don't force these records of the names used to do double duty as the labels that make the spreadsheet intelligible to humans. Separate the roles. One way to do this, but not the only one, is to
Use Insert | Name | Create to add to the workbook names in bulk, in a way that ensures that they match what is documented. Choose names to that related items sort next to each other in an alphabetic listing. See also |