950 likes | 2.14k Views
Using Excel as a database tool. Objectives: Sorting data Filtering data Using Subtotals Pivot Tables Importing and Exporting Files Using Text Functions to Modify Data Data Analysis Tools Writing a Macro to Manipulate Data. A Spreadsheet or a Database Application?.
E N D
Using Excel as a database tool Objectives: • Sorting data • Filtering data • Using Subtotals • Pivot Tables • Importing and Exporting Files • Using Text Functions to Modify Data • Data Analysis Tools • Writing a Macro to ManipulateData
A Spreadsheet or a Database Application? Use a Spreadsheet for: • Small to medium amounts of data • 1-3 Tables of related information • Simple sorting, filtering, and subtotaling Use a Database Management System (DBMS) for: • Large amounts of data • Multiple tables of related information • Complex querying (multidimensional) Often analysts use both tools to solve a problem, keeping track of data in a database application and copying the relevant information for further analysis in Excel
The data To demonstrate many of the data manipulation features of Excel consider the following data table listing a variety of snack products
Excel can import data from both fixed width and delimited files • Choose Data Ribbon, click From Text button in the Get External Data group • Select the data file to be imported • Complete the steps of the Text Import Wizard • Be sure to specify field type so numbers like zip codes won’t lose leading zeros. 4
Excel provides multiple level data sorting by values, cell color, font color or cell icon 1. A simple single field Sort – use buttons from the Data Ribbon. 2. Use the Sort button to sort or Custom Sort to set major And minor sorts. To sort by category then by supplier – first add the category Level then the supplier level. Each level can be sored in Ascending or Descending order.
Excel’s Filter tool allows the user to specify criteria in multiple fields • Select the Filter button from the Data ribbon • In the desired field click on the drop down arrow • Select the filter desired, and specify as needed • Applying multiple filters will be treated as an AND
Advanced Filters allow the user to create OR relationships in multiple fields or to vary criteria based on calculations • Setup your filter range and input the criteria. Criteria in the same row acts as AND, criteria on adjacent rows acts as OR • Select the Advanced button from the Sort & Filter Group of the Data ribbon
Many of these same features and more can be accessed by turning your list into a Data Tables features Using the Insert table from the insert ribbon – Excel defines the area as a table and gives you multiple tools for formatting and managing the data – from a context specific ribbon
Excel can automatically create group Subtotals to perform sums, counts, averages, etc. • Sort by your Group field • Select Subtotals button on the Data ribbon • Choose Group field (change) • Select a function • Select a Subtotal field • Click OK to calculate • Repeat the procedure to calculate a 2nd aggregate function
Pivot Table, a multidimensional summary • Select Pivot Table from the Insert ribbon – Tables group. • Specify Pivot Table as the object • Select the data range and whether the table will be created on a new worksheet. • Arrange data fields on the table
Arranging data fields • Drag the field you wish to use for rows to Row Labels box • Drag field you wish to use for column to Column Label box • Drag fields you wish to perform calculations to either row/column as desired. • To change the calculation type – right click on the value on the table and select Value Field Settings (or Field Settings on Options ribbon. • Use Design ribbon to format
The resulting Pivot Table • Data can also be displayed as a Pivot chart. • Both Pivot tables and charts can be used in Excel and in Access. • If the data is later modified, the button to update the values Data summarized by category by supplier with discontinued filter or insert Slicer
Using Text Functions to modify data We often need to modify data formats for purposes of importing or exporting files. • Registrar’s site downloads: jones.23@jcpn.com • Site login requires: jones.23 or last, first name =CONCATENATE(A2, ", ", B2) Use text functions to combine and separate fields =LEFT(C2, FIND("@",C2) -1)
Then there’s copying and “copying” • Copy – leave it up to office to decide? • Copy as a picture or as text – retains none of the original features. • Embed - copiesobjects such as Excel charts/worksheets in its original source application format. If you double click on the object, it allows you to edit the object using the Excel features (displays Excel menus). • Link - Dynamically “links” to an object in the source document – so it cannot be modified independent of the original object.
Excel can export data into many commonly used file formats. • Select File, the Save As • Choose the appropriate format • CSV comma delimited file • XML format • TXT format – tab delimited • HTML – web page Select the file type from the Save as type box
Data Analysis Tools • Histograms • Regression Analysis • Moving Average • t-Tests • Random Number Generation • Anova • Fourier Analysis
To Load/Use Data Analysis Tools • To Load the Analysis ToolPak for 1st time • From the File Ribbon select Options • Select Add-ins • Select Excel Add-ins in the Manage dropdown list • Click on the Go button at the bottom • Select one or more Add-ins to load To use the tools click on Data Analysis button in the Analysis Group of the Data Tab.
Data Analysis Tools – Histogram Select the appropriate data analysis tool, fill in the required parameters, view the resulting tables/charts
An Excel Macro can record the steps we take and save them for later execution This comes in handy if you are performing the same steps over and over again. • Example – in a single macro can: • Can import data from one or more files • Sort the data • Manipulate the information info appropriate fields • To record a Macro go to the View Ribbon and click on the Macro button, the Record Macro. The computer generates VBA code for the steps. • Control key shortcuts and/or toolbar buttons can be setup to execute a Macro
Using Mail Merge in MS Word with Excel/Access lists to create customized documents, labels & envelopes • Create individualized letters from one template substituting “customized” fields from a database or spreadsheet. • Filter out names from a mail list that meet specific criteria.
1. The Data Source: Preparing your data • If using a spreadsheet make sure all the data is in adjacent columns and rows. It is recommended that you name your data range
2. Link the data source to the document • Open Word and select the Mailings ribbon. Then click on Select Recipients. Then choose whether you are creating a new list, using an existing list or Outlook contacts. If using an existing file – select from the correct folder.
3. Setting up the template document & performing the merge • Type your message into Word. • Insert merge fields from the data source by clicking on the Insert Merge Field button on the Mailing Ribbon. All available fields will be listed. • When you are done – use the Preview Results button and record buttons to see the merged document. • Click the Finish & Merge button to Edit, Print or Emails documents
Excel data capabilities: • As a database for limited amounts of info: • Multiple Sorts • Filters & Advanced Filters • Subtotals • Pivot Tables • Importing and Exporting csv files • Other features using Excel data • Data Analysis tools (histogram) • Text functions to manipulate data • Macros to automate repeated procedures • Mail merge to create customized mailings