naming in excel
DESCRIPTION
Naming in Excel. Excel Objects and Names. Every Excel object is contained in a workbook A workbook is divided into worksheets (individual spreadsheets); it can also contain charts, macros (Excel VBA programs) and other objects Each object has to be identifiable by a name - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/1.jpg)
Naming in Excel
![Page 2: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/2.jpg)
Excel Objects and Names
• Every Excel object is contained in a workbook• A workbook is divided into worksheets
(individual spreadsheets); it can also contain charts, macros (Excel VBA programs) and other objects
• Each object has to be identifiable by a name• We’ll start by looking at cells
![Page 3: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/3.jpg)
Built-in Names
• In Excel, columns are named with letters such as A, B, etc; if you need more than 26 columns then you get names like AA, AB, and so on
• Rows are numbered• The default way of referring to a cell is by its
column and row, as B12, for example
![Page 4: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/4.jpg)
Cell B12 is highlighted
![Page 5: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/5.jpg)
Cell Names in Formulas
• The most common reason to use cell names is in creating formulas
• Cell names can be relative (or partially so) or absolute
• Use a relative name when you want copies of the formula to adjust depending on what row or column they’re in
• Use an absolute name when you want to always refer to the same cell in every copy of the formula
![Page 6: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/6.jpg)
Formula Using a Relative Name
![Page 7: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/7.jpg)
Writing a Relative Name
• The name A1 is relative: this is the default choice
• This formula says to add 3 to A1. Since it is in cell B1, that is where the answer will show up.
![Page 8: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/8.jpg)
After pushing the enter key…
![Page 9: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/9.jpg)
Copy the formula and paste it down the column
![Page 10: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/10.jpg)
Each copy refers to its own row
![Page 11: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/11.jpg)
Built-in Functions
• Excel comes with lots of very useful functions built in
• The next slide shows an example using the function AVERAGE
• Note the use of A1:A8 to name the range of cells in column A from position 1 to 8 inclusive
![Page 12: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/12.jpg)
A10 is the Average of A1 to A8
![Page 13: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/13.jpg)
Subtract the Average from A1: Note the $ used to create an absolute name
![Page 14: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/14.jpg)
Pasting down the column: The relative reference changes, but not the absolute
![Page 15: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/15.jpg)
Copying a Copy…
In the next example, I used a relative formula to add three to each element in A, and store the result in B. I then copied the same formula into column C. Note that it uses the values in B; the idea of the relative reference is to use the column to the left of the current column
![Page 16: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/16.jpg)
Formula for Column B
![Page 17: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/17.jpg)
Same formula copied to C
![Page 18: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/18.jpg)
Fixing just the column
• Suppose I want the formula to change to the current row, but keep using column A.
• I can do that by just putting a $ in front of the A: instead of $A$1, use $A1
![Page 19: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/19.jpg)
Column Absolute, Row Relative
![Page 20: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/20.jpg)
Meaningful Names
• I can also give a meaningful (user-defined) name to a cell
• User-defined names are always absolute• I’ll name the cell A10 as colAvg, then use that
name in a formula (note I actually used colAavg due to a typo)
![Page 21: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/21.jpg)
Type the name and press enter
![Page 22: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/22.jpg)
The formula using the name
![Page 23: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/23.jpg)
The Name Manager (Windows)
• If you use a lot of names you might forget exactly what some are or what they refer to
• If you go to the Formula tab in Excel, and click on the Name Manager, it will show you all your names, with their definitions and current values
• You do this a different way on the Mac; we’ll look at that afterwards
![Page 24: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/24.jpg)
Name Manager Example
![Page 25: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/25.jpg)
Sorting out Names
• There is a cell named A1 on every worksheet in the workbook.
• Within a worksheet, the name is unique and there is no problem
• To refer to cell A1 on another sheet, say Sheet2, use the name of the sheet as in Sheet2!A1
![Page 26: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/26.jpg)
An Analogy• You can think of cell names on a worksheet as being like
names in a family• In a regular family each person usually has a unique name
that everyone uses• But if we consider a class in school, there are likely to be
several people with the same given name. In that case the teacher uses family names as well
• The sheet name is like the family name: it makes it clear exactly which A1 we mean, as in Sheet1!A1. But within a sheet, like within a family, there is no need for the family name
![Page 27: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/27.jpg)
Scope
• So the scope of a name is the part of the workbook where the name has a unique meaning and can be used without modification
• The scope of a name (like colAvg) that we give to an object is the whole workbook; you do not need to use the sheet name when referring to it on another sheet, and the name can only be defined one time in a workbook
![Page 28: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/28.jpg)
Naming a Range
• Highlight the cells you want to name• Go to the Formulas tab and find the Define
Names panel; click on Define Name• Type the name you want to use in the window
that comes up
![Page 29: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/29.jpg)
Click on Define Name
![Page 30: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/30.jpg)
Put the name here and click OK
![Page 31: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/31.jpg)
Use it in a formula
![Page 32: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/32.jpg)
New View of Name Manager
Notice how the defined names are absolute references
![Page 33: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/33.jpg)
Finding Definitions on the Mac
• In the Windows version (Excel 2010) there is a Name Manager
• Finding definitions in the Mac version (Excel 2011) is a little trickier
• We’ll start by defining a couple of named ranges, and then show how to find the names
![Page 34: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/34.jpg)
I just named cell A1 “root”
Cell A1 is selected, and I typed the name “root” in the name box at the upper left, and hit return
![Page 35: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/35.jpg)
Create a list of powers of root…
The formula in cell B1 is “=root”The formula in B2 is “=B1*root”This formula is copied down the column to create the list of powers of root
![Page 36: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/36.jpg)
Create a named range “powers”
I selected the range and typed the name “powers” in the name box
![Page 37: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/37.jpg)
To find the list of definitions…
• Using the Insert menu, follow the entries Insert -> Name -> Define
• (see the next slide)
![Page 38: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/38.jpg)
The resulting definition list…
I selected “powers” in the list box and it isshowing me the definition of powers: (notethe use of absolute addresses)=Sheet1!$B$1:$B$11
![Page 39: Naming in Excel](https://reader035.vdocuments.mx/reader035/viewer/2022062323/5681634f550346895dd3eee0/html5/thumbnails/39.jpg)
Why use Defined Names?
• It can make your spreadsheets much more readable and less error-prone
• This is especially true if you use lots of formulas