part © 2015 Cengage Learning All Rights Reserved May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in Business Analytics: Data Analysis and Chapter Decision Making 18 Importing Data into Excel Introduction Any statistical analysis presumes that you have the appropriate data in a format suitable for analysis The data might exist: In an Excel® file—which might still need to be rearranged to get it in the form of a rectangular data set In a text file (or ASCII file)—which is any file that can be opened and read in a text editor such as Notepad; it can be imported into Excel using Excel’s text import wizard In a relational database (such as Access, SQL Server, Oracle)—which can be imported into Excel by forming a query using the Microsoft Query package A query specifies exactly which data you want to import On the Web—which can be imported into Excel by creating a query and then running it in Excel Once the data is imported, it may need to be cleansed to fix wrong values © 2015 Cengage Learning All Rights Reserved May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Rearranging Excel Data Even if the data already exists in Excel, it may need to be rearranged in the form of a data set—a rectangular array of data with observations in rows, variables in columns, and variable names in the top row Sometimes simple cutting and pasting works In other cases, advanced Excel functions are required In all cases, it is best to map out a plan and then decide how to implement it © 2015 Cengage Learning All Rights Reserved May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Example 18.1: Baseball Salaries Original.xlsx Objective: To rearrange the data from the baseball Web queries into a single data set Solution: Data on baseball salaries was imported into Excel from a Web site, with a separate Web query for each of the 30 teams The results for a typical team are shown to the right, with only a few players listed To rearrange all of the data into four long columns with the headings Player, Team, Salary, and Position, follow these steps: Insert a blank column before column B, and enter the label Team in cell B2 Cut the Arizona Diamondbacks team name from cell A1 and paste it next to the first Arizona player in cell B3 Then copy it down for the other Arizona players Repeat step for each of the other teams Delete unnecessary rows of labels for the other teams © 2015 Cengage Learning All Rights Reserved May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Example 18.2: CPI.xlsx (slide of 2) Objective: To rearrange the monthly data into two long columns, one with month-year and one with the CPI Solution: Monthly data on the Consumer Price Index (CPI) was imported from the Web using a Web query A few rows appear below The desired results after rearranging are shown to the right © 2015 Cengage Learning All Rights Reserved May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part Example 18.2: CPI.xlsx (slide of 2) To rearrange the data into two long columns, follow these steps: Create the range name Data (for all the CPI values, not the headings in row or column A) Add a new worksheet for the rearranged data, create the column headings in row 1, enter in cells A2 and B2, and enter 1913 in cell C2 To generate the recurring pattern of to 12 in column B, enter the formula =IF(B2