|Shelly Cashman Excel 2019 | Module 10: SAM Project 1a|
ANALYZING DATA WITH POWER TOOLS AND CREATING MACROS
- Open the file SC_EX19_10a_FirstLastNamexlsm, available for download from the SAM website.
- Save the file as SC_EX19_10a_FirstLastNamexlsm by changing the “1” to a “2”.
- If you do not see the .xlsm file extension in the Save As dialog box, do not type it. The program will add the file extension for you automatically.
- To complete this SAM Project, you will also need to download and save the following data files from the SAM website onto your computer:
- With the file SC_EX19_10a_FirstLastNamexlsm still open, ensure that your first and last name is displayed in cell B6 of the Documentation sheet.
- If cell B6 does not display your name, delete the file and download a new copy from the SAM website.
- To complete this project, you need to display the Power Pivot and Developer tabs. If these tabs do not display, right-click any tab on the ribbon, and then click Customize the Ribbon on the shortcut menu. In the Main Tabs area of the Excel Options dialog box, click the following check boxes:
- Power Pivot
Click the OK button to close the Excel Options dialog box and add the Developer tab, the Power Pivot tab, and the buttons for the Power tools to the ribbon.
- PROJECT STEPS
- Ravi Mehta is the finance director for the Home Security Group of Franklin National, a North American manufacturing company. Ravi is developing an Excel workbook that his managers can use to track and interpret data about customers, contracts, and invoices. He asks for your help in setting up tools to analyze the data and to automate the workbook to make it easier to use.
Go to the Home Page Ravi wants to include a list of links to resources his managers are likely to need. However, the first link he added is unnecessary.
Remove the hyperlink from the text in cell C4.
- Ravi wants to make it easy for users to navigate to the other worksheets. Add links to other places in the workbook as follows:
- In cell C5, insert a link to cell A1 of the Customers
- In cell C6, insert a link to cell A1 of the Contracts
- In cell C7, insert a link to cell A1 of the Invoices
- Ravi also wants users to be able to access archived contract data as they prepare new contracts. Ravi stores the archived data in an Excel workbook. Add a link to the file as follows:
- In cell C8, insert a link to the file xlsx.
- Add the following text as a ScreenTip that explains what happens when users click the link:
Open an archive of contract data.
- The Franklin National website provides information Ravi’s managers use every day. In cell C9, add a link to the fn.example.com website.
- Ravi also wants to include a way that managers can request information from the home office of Franklin National. In cell C10, add a link to the firstname.lastname@example.org email address.
- Ravi’s plan is that when users click the Add Customer button in the range D3:E3, the Customers worksheet opens and Excel adds a new, blank record to the Customer table, where users can insert the new customer information. Record a macro to automate the Add Customer button as follows:
- Enable all macros in the workbook, and then display the Developer tab on the ribbon.
- Record a macro stored in this workbook using Add_Customer as the name of the macro.
- While recording the macro, display the Customers worksheet.
- Also, while recording the macro, add a new blank record to the end of the Customer table.
- Stop recording the macro.
- Assign the Add_Customer macro to the Add Customer button and then run the Add_Customer macro to make sure it inserts a new record at the bottom of the Customer table on the Customers
- Ravi has already created similar macros to add a new contract record and a new invoice record. Return to the Home Page worksheet, and assign the macros to buttons as follows:
- Assign the Add_Contract macro to the Add Contract button.
- Assign the Add_Invoice macro to the Add Invoice button.
- Go to the Customers Ravi wants to create PivotTables that include customer, contract, and invoice data. He already added the tables containing this data to the Data Model. Ravi wants to list and total each contract amount by city and signing date.
Create a PivotTable that displays this information as follows:
- Use Power Pivot to create a PivotTable on a new worksheet, using Contracts by City as the name of the worksheet.
- Display the City field values from the Query – Customer data source as row headings.
- Display the SigningDate field values from the Query – Contract data source as column headings.
- Add the ContractAmt field from the Query – Contract data source to the Values area to sum the field values. (Ignore the alert that states “Relationships between tables may be needed.”, these relationships will be created in a later step.)
- Group the signing dates to display them as years and quarters only. (Hint: Expand the year headings to display the quarter headings, if necessary.)
- Ravi also wants to list the paid and unpaid invoices for each month and then filter them by contract type. Create a PivotTable that displays this information as follows:
- Use Power Pivot to create a PivotTable on a new worksheet, using Invoices by Month as the name of the worksheet.
- Display the SigningDate field values from the Query – Contract data source as row headings.
- Display the InvoicePaid field values from the Query – Invoice data source as column headings.
- Sum the InvoiceAmt field values from the Query – Invoice data source. (Ignore the alert that states “Relationships between tables may be needed.”, these relationships will be created in a later step.)
- Use the ContractType field from the Query – Contract data source as a filter.
- Group the signing dates to display them as years and months only. (Hint: Expand the year headings to display the month headings, if necessary.)
- To properly combine data from the Customer, Contract, and Invoice tables, create relationships between tables as follows:
- In the Power Pivot for Excel window, create a relationship between the Customer and Contract tables using the CustomerID column to relate the tables.
- Create a relationship between the Contract and Invoice tables using the ContractNum column to relate the tables.
- Ravi wants to show invoices for security plans only and want to make the PivotTable easier to interpret. Modify the PivotTable as follows to meet Ravi’s requests:
- Use Unpaid as the column heading in cell C4.
- Use Paid as the column heading in cell D4.
- Filter the PivotTable to display invoices for the Security plan and Security plan for apartment building contract types.
- Return to the Customers In the range J2:K5, Ravi wants to list the total contract amounts for three cities. Extract this information from the PivotTable on the Contracts by City worksheet as follows:
- In cell K3, use the GETPIVOTDATA function to display the total contract amount for Atlanta from the PivotTable on the Contracts by City worksheet (cell J9). (Hint: Type an equal sign in cell K3 and then click the cell containing the value you want the GETPIVOTDATA function to get from the PivotTable.)
- In cell K4, use the GETPIVOTDATA function to display the total contract amount for College Park from the PivotTable on the Contracts by City worksheet (cell J16).
- In cell K5, use the GETPIVOTDATA function to display the total contract amount for Dunwoody from the PivotTable on the Contracts by City worksheet (cell J20).
Save the workbook, making sure to save it as a macro-enabled workbook.
Your workbook should look like the Final Figures on the following pages. Save your changes, close the workbook, and then exit Excel. Follow the directions on the SAM website to submit your completed project.
Final Figure 1: Home Page Worksheet
Final Figure 2: Invoices by Month Worksheet
Final Figure 3: Contracts by City Worksheet
Final Figure 4: Customers Worksheet
Final Figure 5: Contracts Worksheet
Final Figure 6: Invoices Worksheet