1 CS 106 Computing Fundamentals II Chapter 16 “Naming In Excel” Herbert G. Mayer, PSU CS Status 7/6/2013 Initial content copied verbatim from CS 106 material.

Slides:



Advertisements
Similar presentations
Introduction to Excel This class is “HANDS-ON” you will need to open up an excel spreadsheet and do examples as you go along. Students will be able to.
Advertisements

(MICROSOFT EXCEL). Is a spreadsheet application designed to take advantage of the windows graphical interface MICROSOFT EXCEL.
Naming in Excel. Excel Objects and Names Every Excel object is contained in a workbook A workbook is divided into worksheets (individual spreadsheets);
Slide No. 1 Chapter 1, Unit c Relative vs. Absolute Addressing in a Spreadsheet H Spreadsheet Address H Relative Address H Absolute Address H Examples.
Lesson 12 Getting Started with Excel Essentials
Review Ch. 15 – Spreadsheet and Worksheet Basics © 2010, 2006 South-Western, Cengage Learning.
Microsoft Excel Presented by ShoWorks Fair Software and Online Entries
 Microsoft Excel is an electronic spreadsheet.  As with a paper spreadsheet, you can use Excel to organize your data into rows and columns and to perform.
Microsoft Office XP Microsoft Excel
Microsoft Excel. What is Microsoft Excel? Spreadsheet program that allows users to organize data, complete calculations, make decisions, and graph data.
Microsoft Excel Computers Week 4.
Objectives 1.Identify the functions of a spreadsheet 2.Identify how spreadsheets can be used. 3.Explain the difference in columns and rows. 4.Locate specific.
Practical Computing by Lynn Hogan. Practical Computing Chapter 8 Creating Spreadsheets (Using Microsoft Excel 2007)
Chapter 1 Introduction to Spreadsheet. Agenda Download the practice files Spreadsheet application Workbook and worksheet Toolbar Cell Formatting Printing.
1 CS110: Lecture 2 Spreadsheets Prepared by Fred Annexstein University of Cincinnati CC Some rights reserved Today’s Topics Basics of Excel Spreadsheets.
EXCEL BASICS WELCOME  TODAY’S CLASS WILL COVER :  Moving Around Excel – CELLS  Highlighting, Editing, Formatting.
Excel Web App By: Ms. Fatima Shannag.
FIRST COURSE Excel Lecture. XP 2 Introducing Excel Microsoft Office Excel 2007 (or Excel) is a computer program used to enter, analyze, and present quantitative.
Spreadsheet. Objectives Create a new blank workbook. Create a new blank workbook. Identify user interface elements that you can use to accomplish basic.
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
Microsoft Excel Diane M. Coyle Spring 2009 CS 105.
1 CS 106 Computing Fundamentals II Chapter 17 “Introduction To VBA” Herbert G. Mayer, PSU CS status 6/30/2013 Initial content copied verbatim from CS 106.
VBA for Excel. What is a spreadsheet? u An Excel spreadsheet is a set of worksheets  Each worksheets is made up of rows and columns of cells  Rows are.
1 CS 106 Computing Fundamentals II Chapter 25 “Variables, Assignment Statement” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
1 CS 106 Computing Fundamentals II Chapter 29 “Creating A User Form” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim from CS 106.
 Starting Excel 2003  Using Help  Workbook Management  Cursor Management  Manipulating Data  Using Formulae and Functions  Formatting Spreadsheet.
Spreadsheet A spreadsheet is the computer equivalent of a paper ledger sheet. It consists of a grid made from columns and rows. It is an environment that.
1 CS 106 Computing Fundamentals II Chapter 7 “Showing Developer Tab” Herbert G. Mayer, PSU CS status 6/17/2013 Initial content copied verbatim from CS.
1 CS 106 Computing Fundamentals II Chapter 4 “Excel Basics for Mac” Herbert G. Mayer, PSU CS status 6/27/2013 Initial content copied verbatim from CS 106.
Excel Spreadsheet basics. Excel Sheets and Books  Spreadsheet: tool to analyze, chart and manage data for personal, business and financial use Worksheet:
CHAPTER 13 Creating a Workbook Part 1. Learning Objectives Understand spreadsheets and Excel Enter data in cells Edit cell content Work with columns and.
1 CS 106 Computing Fundamentals II Chapter 34 “Conditionals In Excel” Herbert G. Mayer, PSU CS Status 7/17/2013 Initial content copied verbatim from CS.
Excel Spreadsheet basics. Excel Sheets and Books  Spreadsheet: tool to analyze, chart and manage data for personal, business and financial use Worksheet:
This is the first sheet of a spreadsheet workbook. The workbook begins initially with 3 work sheets. A spreadsheet is made of columns and rows. The intersection.
Introduction to Spreadsheets Program: Excel. Starting Excel Spreadsheets Spreadsheet –A grid of rows and columns used to make calculations. A spreadsheet’s.
Exploring Office 2003 Vol 1 2/e - Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Chapter 1 – Introduction to Excel: What is.
Cell Alignment By default, text is left aligned and values are right aligned. You can also adjust vertical alignment.
VBA Lab 2 I ns.Samia Al-blwi. Visual Basic Grammar Object: Visual Basic is an object-oriented language. This means that all the items in Excel are thought.
1 Microsoft Excel An Introduction to Spreadsheets Lecture 18.
1 CS 106 Computing Fundamentals II Chapter 84 “Array Formulae” Herbert G. Mayer, PSU CS status 6/14/2013 Initial content copied verbatim from CS 106 material.
Excel Web App By: Ms. Fatima Shannag.
Microsoft Excel. Excel specializes in creating and designing spreadsheets, or worksheets Worksheet – area to insert data Workbook – a set of worksheets.
PERFORMING CALCULATIONS Microsoft Excel. Excel Formulas A formula is a set of mathematical instructions that can be used in Excel to perform calculations.
Spreadsheets What is Excel?. Objectives 1. Identify the parts of the Excel Screen 2. Identify the functions of a spreadsheet 3. Identify how spreadsheets.
Using Sheets To help with data. Sheets is a spreadsheet program that can interface with forms, docs, or presentations. A spreadsheet program has cells.
1 CS 106 Computing Fundamentals II Chapter 210 “Adding Controls to User Forms” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
Unit 24 Learning Spreadsheet Essentials Starting on page 287  Mrs. Jefcoat  Business Technology Applications Unit 24: Lessons
1 CS 106 Computing Fundamentals II Chapter 28 “Scope” Herbert G. Mayer, PSU CS Status 7/14/2013 Initial content copied verbatim from CS 106 material developed.
An electronic document that stores various types of data.
How to Grade with Excel Basics and Formulas. How to Grade with Excel  A cell is the cross-section of row and column  Whatever cell is selected is shown.
COM: 111 Introduction to Computer Applications Department of Information & Communication Technology Panayiotis Christodoulou.
COMPUTER LITERACY NOTES MS-EXCEL. SPREADSHEETS A spreadsheet is a computer equivalent of a paper ledger sheet. Excel allows you to create spreadsheets.
1 CS 106 Computing Fundamentals II Chapter 85 “Excel Tables” Herbert G. Mayer, PSU CS status 6/14/2013 Initial content copied verbatim from CS 106 material.
Chapter 6 Modifying Cell Styles
CS 106 Computing Fundamentals II Chapter 5 “Excel Basics for Windows”
Formatting a Worksheet
Statistical Analysis with Excel
Microsoft Excel.
Microsoft Excel A Spreadsheet Program.
Computer Fundamentals
Statistical Analysis with Excel
CS 106 Computing Fundamentals II Chapter 71 “Indexing”
CS 106 Computing Fundamentals II Chapter 66 “Working With Strings”
Microsoft Excel 2007 Introduction to Spreadsheet Programs
CS 106 Computing Fundamentals II Chapter 69 “Event Loop”
Chapter 6 Lesson 5.
Intro to Excel CSCI-150.
Unit G: Using Complex Formulas, Functions, and Tables
Spreadsheets and Data Management
Exploring Microsoft Excel 2003
Presentation transcript:

1 CS 106 Computing Fundamentals II Chapter 16 “Naming In Excel” Herbert G. Mayer, PSU CS Status 7/6/2013 Initial content copied verbatim from CS 106 material developed by CS professors: Cynthia Brown & Robert Martin

2 Syllabus Excel Objects And Names Excel Objects And Names The WorkBook The WorkBook Common Built-In Names Common Built-In Names Cell B 12 Highlighted Cell B 12 Highlighted Cell Names in Formulas Cell Names in Formulas Relative Names Relative Names Built-in Functions Built-in Functions Name Manager Name Manager Scope Scope

3 Excel Objects and Names Every Excel object is contained in a workbookEvery 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 objectsA 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 nameEach object has to be identifiable by a name We’ll start by looking at cellsWe’ll start by looking at cells

4 The WorkBook Whether your WorkBook has 1 WorkSheet or many, all activity starts with opening the WorkbookWhether your WorkBook has 1 WorkSheet or many, all activity starts with opening the Workbook This is an “event”This is an “event” To associate “initialization work” with a VBA project, place all initialization actions into a sub that is activated automatically, when the WorkBook opensTo associate “initialization work” with a VBA project, place all initialization actions into a sub that is activated automatically, when the WorkBook opens That is the special, and predefined:That is the special, and predefined: sub Workbook_Open() A similar function for user forms:A similar function for user forms: Sub UserForm_Initialize()

5 The WorkBook Sub Workbook_Open() Cells( 1, 1 ).Value = “Hello:”... ‘ other cells being populated ' now have columns be width-adjusted: Cells.Columns.AutoFit Cells.Columns.AutoFit End Sub

6 Common 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 onIn 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 numberedRows are numbered The default way of referring to a cell is by its column and row, B12 for exampleThe default way of referring to a cell is by its column and row, B12 for example A sampling of pre-defined names, some you saw earlier:A sampling of pre-defined names, some you saw earlier: Workbook_Open() UserForm_Initialize() Cells() Cells.Columns.AutoFit ActiveCell

7 Common Built-in Names Other common, predefined names in VBA: ActiveCellcell of current cursor positionActiveCellcell of current cursor position ActiveCell.Interiorproperty of cell at current cursorActiveCell.Interiorproperty of cell at current cursor ActiveCell.Interior.colorobviousActiveCell.Interior.colorobvious lstBx.AddItem( “text” )print text on next line of list boxlstBx.AddItem( “text” )print text on next line of list box Cells()2d grid of all Excel cellsCells()2d grid of all Excel cells Cells.Columns.AutoFitadjust cell width to content widthCells.Columns.AutoFitadjust cell width to content width cInt( “text” )convert text to integer valuecInt( “text” )convert text to integer value Format( double, “cmd” )print double-prec. according to cmdFormat( double, “cmd” )print double-prec. according to cmd Option Explicitcommand avoids default declarationOption Explicitcommand avoids default declaration ThisWorkbook.Workbook_Openmain macro at startThisWorkbook.Workbook_Openmain macro at start UserForm_Initialize()macro, event at user form opening vbRedcolor value, just 1 sample vbCrcarriage return line feed character X.Captiona property of label ‘x’ X.Texttype of data in text box ‘x’ X.Visiblea property of label ‘x’, T/F Workbook_Open()macro, event at program loadingWorkbook_Open()macro, event at program loading

8 Cell B12 Highlighted

9 Cell Names in Formulas The most common reason to use cell names is in creating formulasThe most common reason to use cell names is in creating formulas Cell names can be relative or absoluteCell names can be relative or absolute Use a relative name when you want copies of the formula to adjust depending on what row or column they’re inUse 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, regardless of future row and column addition (or deletion)Use an absolute name when you want to always refer to the same cell in every copy of the formula, regardless of future row and column addition (or deletion)

10 Formula Using a Relative Name

11 Writing a Relative Name Name A1 is relative: this is the default choiceName A1 is relative: this is the default choice Formula =A1+3 says to add 3 to A1. Since it is in cell B1, that is where the answer will show upFormula =A1+3 says to add 3 to A1. Since it is in cell B1, that is where the answer will show up

12 After pushing the enter key…

13 Copy Formula, Paste down Column

14 Each copy refers to its own row

15 Built-in Functions Excel comes with lots of useful functions built inExcel comes with lots of useful functions built in The next slide shows an example using the function AVERAGEThe 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 inclusiveNote the use of A1:A8 to name the range of cells in column A from position 1 to 8 inclusive

16 A10 is the Average of A1 to A8

17 Subtract the Average from A1: Note $ to create an absolute name

18 Pasting down the column: relative references change, not absolutes!

19 Copying a Copy… Next sample uses a relative formula to add three to each element in A, and store the result in BNext sample uses a relative formula to add three to each element in A, and store the result in B We copy the same formula into column CWe copy 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 columnNote 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

20 Formula for Column B

21 Same formula copied to C

22 Fixing just the Column Suppose I want the formula to change to the current row, but keep using column ASuppose I want the formula to change to the current row, but keep using column A Accomplished by just putting a $ in front of the A: instead of $A$1, use $A1Accomplished by just putting a $ in front of the A: instead of $A$1, use $A1

23 Column Absolute, Row Relative

24 Absolute and Relative Show macros rel_abs in class!

25 Meaningful Names User can give a meaningful name to a cellUser can give a meaningful name to a cell But user-defined names are always absoluteBut user-defined names are always absolute We name cell A10 as colAvg, then use that name in a formulaWe name cell A10 as colAvg, then use that name in a formula Note Dr. Brown actually used colAavg due to a bona- fide typoNote Dr. Brown actually used colAavg due to a bona- fide typo

26 Type Name, Press enter

27 The formula using the name

28 Name Manager Example

29 Sorting out Names Each worksheet has a cell named A1Each worksheet has a cell named A1 That is each worksheet of a workbook, hence there may be numerous A1 cellsThat is each worksheet of a workbook, hence there may be numerous A1 cells Within a worksheet, the name is unique and there is no problemWithin 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!A1To refer to cell A1 on another sheet, say Sheet2, use the name of the sheet as in Sheet2!A1

30 An Analogy You can think of cell names on a worksheet as being like names in a familyYou 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 usesIn 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 wellBut 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 nameThe 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

31 Scope Scope is the range of text, over which a name is uniquely known and validScope is the range of text, over which a name is uniquely known and valid The scope of a cell ID is just the worksheetThe scope of a cell ID is just the worksheet The scope of a name 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 workbookThe scope of a name 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

32 Naming a Range Highlight the cells you want to nameHighlight the cells you want to name Go to the Formulas tab and find the Define Names panel; click on Define NameGo 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 upType the name you want to use in the window that comes up

33 Click on Define Name

34 Put the name here and click OK

35 Use it in a formula

36 New View of Name Manager Notice how the defined names are absolute references

37 Finding Definitions on the Mac In the Windows version (Excel 2010) there is a Name ManagerIn the Windows version (Excel 2010) there is a Name Manager Finding definitions in the Mac version (Excel 2011) is a little trickierFinding 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 namesWe’ll start by defining a couple of named ranges, and then show how to find the names

38 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

39 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

40 Create a named range “powers” I selected the range and typed the name “powers” in the name box

41 To find the list of definitions… Using the Insert menu, follow the entries Insert -> Name -> Define (see the next slide)

42 The resulting definition list… I selected “powers” in the list box and it is showing me the definition of powers: (note the use of absolute addresses) =Sheet1!$B$1:$B$11

43 Why Use Defined Names? It can make your spreadsheets much more readable and less error-proneIt can make your spreadsheets much more readable and less error-prone This is especially true if you use lots of formulasThis is especially true if you use lots of formulas