In-Class Excel Practice Activities ACCT 5310 This Semester: We are learning to use Excel, but also improving our critical thinking skills. Be self-reliant and find Excel resources that will be useful to you. You’ll never remember how to do everything in Excel, so build your own Excel “go-to” library. Learn Excel keyboard shortcuts! They will save you time and frustration. You’ll be working with large data sets. Mastering keyboard shortcuts also makes you look like an Excel Rockstar! In the professional world, Excel shortcuts and speed are a great way to differentiate yourself from your peers. Preserve your source data, do not overwrite it with your formula. Use formulas in separate columns to clean/transform your data. Think critically to identify data that needs to be cleaned or to use the data provided to transform/create data attributes that you need for your analysis. The data does not always come to you in a nice, neat Excel spreadsheet. Data is generally dirty, and you will spend a lot of time cleaning, transforming, and prepping it so you can then use and analyze it. Let’s open the OPA Records - Students file to gain an understanding of how dirty data can be and how we can use Excel functions to clean and transform our data. Import Data from A .txt File We want to add the data from the “Text File_040416.txt” file into our OPA workbook. Let’s look at the data we want to add. Open the .txt file. Within a new worksheet in Excel: o Go to the “Data” tab on the ribbon. o Select “From Text/CSV”. o Choose the .txt file from the location you have saved it in. You will have to decide how the text file should be imported into the spreadsheet based on how it is saved: For this example, set the delimiter to be “Tab” Click on “Load” Note that the data may be imported as a Table. If you want to remove the Table format, got the Table Design tab on the Ribbon and select “Convert to Range.” Text String Functions Now that we have imported the data from the text file, let’s take a look at it. What do you think might cause a problem? Let’s add filters to help us sort the data to more easily assess the data. Select the data range, click on “Data” tab of Ribbon and select “Filter.” Make sure the range selected is correct, and check that your table has headers. Select “OK.” Alternatively, press Control + Shift + L. Removing spaces and non-printing characters from the text: o As an example, let’s sort column A in ascending order. o Why is Kuwait and (not set) at the top of our list? o Let’s use TRIM to clean up the Kuwait entry. What is the appropriate data cleansing approach to do this? Remember the #1 rule about keeping your source data intact! o Investigate these other Excel functions on your own. You may find them helpful as you learn to clean and prep data: CODE, CLEAN, SUBSTITUTE. Merging text: o There are times when you need to create new data attributes from existing fields. We can use CONCATENCATE, CONCAT or a formula that includes the “&” to concatenate or join text strings. o Let’s create a 4-digit numeric code for each Country/Territory name and join the code to the name with a “-“ in between the code and the name. First, let’s create the 4-digit codes starting with 1001. o Now let’s join those text strings using the following Syntax: =CONCATENATE(text1, [text2], ...) =CONCAT(text1, [text2], ...) =text1&[text2]&… (the ampersand symbol & is a text concatenation operator in Excel and joins text strings into a single string. Splitting text. There are several text string functions in Excel which are extremely useful when we need to extract from a text string. o On your own, do any additional research you need to for a complete understanding of LEFT, MID, RIGHT, and LEN formulas. o Let’s try the LEFT function to extract the 4-digit code from the text string you just created. (Note: You can also use Text to Columns functions to split text into components. We will practice that later in this activity.) Syntax: =LEFT(text,[num_chars]) HINT: brackets “[…]” in an Excel formula means that part of the formula is optional. There will be times when you need it and other times when you do not. As you become familiar with the formulas in Excel, you’ll get a feel for when you need these optional fields, depending on the data you’re working with and the desired outcome. Use the LEFT formula in column O: = LEFT(N2,4). This tells Excel to extract the 4 left characters in the text string in cell N2. o Let’s try extracting the hyphen from the string that we created previously. We can do this using the MID formula Syntax: =MID(text,start_num,num-chars) In our case, we’ll use the following formula in column P: =MID(N2,5,1). This pulls the specified number of characters from the middle of a given cell, and in our case, provides us with “-“ in column P. o Now let’s use a RIGHT function to break out the last set of characters, representing the country name. This is a bit more difficult because the length of each country name varies, so we need a formula that can accommodate for these varied lengths. Syntax: =RIGHT(text,[num_chars]) We will need to use this formula in conjunction with the LEN formula to help accommodate for these varied lengths in country names. Syntax: =LEN(text) In our case, we know that the first 5 characters relate to the code we assigned and the hyphen, so everything after that should be the country name. As such, our formula will look as follows: =RIGHT(N2, LEN(N2)-5) This formula pulls the total number of characters minus 5, which will leave us with country name. Sometime cleaning data can be accomplished using formatting to make sure all the data is consistently formatted. o Look at the Avg. Session Duration Column. Are all cells formatted the same? What does the underlying data say when you highlight a given cell, and does it make any sense? o To clean this column, we will first have to ask the data owner more about the underlying collection of the data and if the data collected matches the column heading. Once we have more information we can properly clean this column. o If you only needed to update the data formatting to complete the cleaning exercise, in which column should you do this? Should we make any formatting changes in the source data? Addressing duplicate rows. o Consider using filters to scan for unique values and then remove duplicates. There is a remove duplicates function under the Data tab of the Ribbon. Take a look at this on your own. o Conditional formatting can also be helpful to determine if there are duplicate rows. This can be found under the Home tab of the Ribbon. Take a look at this on your own (try it out on the Country / Territory field). If/Then Statements NOTE: See Excel #2 video posted to eLC to walk through this step. OPA is interested in estimating the uncollectible debt. Although you, the Controller, will likely consider all sorts of individual characteristics of clients who have not paid their bills before writing off their debts, an easy way to estimate what will be uncollectible is to calculate a percentage of the outstanding debt. To do this, you will use an IF function. If functions are “conditional formulas.” You only perform the function if the cell of interest meets certain criteria. Go to the OPA Jobs worksheet & add a column with the header “Estimated Uncollectible.” In this column, you are going to enter a formula to multiply the contract amount by 10% IF the contract fees have not been collected, but if the contract fees have been collected, then Excel should enter a zero. Syntax: =IF(logical_text,value_if_true,[value_if_false]) =IF (Collected=“N”, Contract Price * .10, 0) = IF(N2=”N”, F2*.10,0) You will also find that nested IF functions are helpful in data cleansing/prep. Let’s try one that categorizes OPA’s small contracts as Small, Medium, Large, and Jumbo. Below are the criteria for each of our contract designations: >$50,000 = Small $50,000 < X < $99,999 = Medium $100,000 < X < $200,000 = Large $200,001 < X = Jumbo Create a column header title that appropriately describes its content and then create the formula to categorize all the OPA contracts. Because there are multiple criteria to evaluate, you will need to use an IF and an AND function. =IF(F2<50000,"Small",IF(AND(F2>=50000,F2<100000),"Medium", IF(AND(F2>=100000,F2<=200000),"Large","Jumbo"))) You can also use the Function Builder to guide you through building functions and more complex calculations. Check out Function Builder if that method appeals to you. Additionally, the Formula Evaluation tool is a great way to step through the formula and make sure it is operating as you expect. Look-up Functions In the Clients tab, client addresses are incomplete. Currently, no city or state is listed. This makes it cumbersome to send invoices or other communications to clients. You’d like to add these to the spreadsheet so that you don’t have to look them up manually every time you have to contact a client. It’s easy to include this data by using a lookup function. Introduction to VLOOKUP, HLOOKUP, AND XLOOKUP: The VLOOKUP function finds a value in the leftmost column of a specified range, such as a table, and then returns the value from the specified cell to the right of the cell with the found value. A properly formed VLOOKUP function has four arguments (data that is passed to the function), as shown in the following definition: =VLOOKUP(lookup_value, table_array, col_index_num, range_lookup) VLOOKUP Argument Name Lookup_value Description Notes Value you want to find The value to be found in the first column in leftmost column of of the range specified by the table_array the table_array argument. The lookup_value argument can be a value, a cell reference, or a text string. Table_Array Range of cells where The multicolumn range or name of the you are looking range or data table to be searched. In this table, you must have the column that has the list of values that will contain the Lookup Value as the very first column (leftmost). Col_index_num Column # of matching The number of the column in the named entry you want to get range with the value to be returned. Range_lookup Approximate or Exact A true/false value, indicating whether the Match function should find an approximate match (true) or an exact match (false) for the lookup_value. If left blank, the default value for this argument is true. However, you will typically input FALSE as you will be looking for an exact match. This video is a basic VLOOKUP tutorial: VLOOKUP - When and how to use it. HLOOKUP does the same thing, but searches based on a table formatted horizontally instead. VLOOKUP and HLOOKUP have some inherent limitations. First, you can only go from left to right or from top to bottom, and you need to know the exact column or row number of the data you’re looking for. So, if the size of the range might change in the future, these functions are risky to use. But, the main issue is the HLOOKUP and VLOOKUP are volatile functions, which means that Excel recalculates them and any cells that depend on them whenever anything in the file changes. This makes the functions less efficient and can cause performance problems. XLOOKUP is a new lookup function that is only available in Microsoft 365. XLOOKUP is an improved version of VLOOKUP that works in any direction and returns exact matches by default. The XLOOKUP function has three required arguments: =XLOOKUP(lookup_value, lookup_array, return_array) XLOOKUP Argument Name Lookup_value Lookup_Array Return_Array Description Value you want to find in the lookup_array Column where you are looking Column(s) containing data you want to return Notes The value to search for The array or range to search The array or range to return. Unlike VLOOKUP, XLOOKUP can return an array with multiple items. For more information on XLOOKUP, this website is helpful. XLOOKUP function Practice with VLOOKUP: Select the “Clients” sheet in the OPA Records - Students in class file. We need source data, which could be a table that we create, already exists here in the spreadsheet, comes from the web, or comes from another spreadsheet. For this, we’re going to use a table from another spreadsheet. Open the zipcodes.xlsx file. Add a column in the Clients sheet for the client’s state. As noted above, the syntax for the VLOOKUP function is: o = VLOOKUP(lookup_value,table_array, col_index_num, range_lookup) In Cell G2, enter your VLOOKUP function as follows: o =VLOOKUP(zip code in Clients worksheet, Source data table zipcodes.csv file, column where the zip code is found in the csv file, false) o =VLOOKUP(D2,[zipcodes.csv]zipcodes!$A$2:$G$43583,3,False) A couple of notes to mention: o See that the list of zip codes is in the leftmost column of the table array. o See that the city is in column 2. o Notice that the cells of the table array are locked in the function ($). Copy this formula to the remainder of the clients listed. Now, do the same thing for the city field in column H. Do you notice any problems with the data imported through your VLOOKUP? Introduction to INDEX and MATCH: Another option to look-up data is the combination of the INDEX and MATCH formulas. INDEX returns the value of a cell in a table based on the column and row number. MATCH returns the position of a cell in a row or column. Combining these two functions, we can look up a value both horizontally and vertically. Using INDEX/MATCH instead of VLOOKUP is preferred by many Excel professionals due to VLOOKUP’s limitations. Use VLOOKUP when the data is relatively small and the source data you are using as the lookup is static (new columns/rows will not be inserted or existing ones deleted). When you have larger amounts of data and you want to create a “repeatable” process without having to change your formula every time there are changes in your source data, you may want to use the combination of INDEX and MATCH functions. The INDEX function returns a value at the intersection of a row number and a column number in a range. The syntax is: =INDEX(Array, Row Number, Column Number) INDEX Argument Name Array Description Notes The range of cells you want Excel to use (i.e. the value you want to return) The range of cells in which you are searching; can be a single column or multiple columns. If a single column, then you don’t need the column number (see note below about column number being an optional input). Note: this will typically be replaced by the MATCH function. Otherwise, you would have to manually input the row number. Note: this will typically be replaced by the MATCH function. Otherwise, you would have to manually input the column number. Optional input – if you don’t enter anything, Excel will assume “1”, which makes it work for one-column ranges. Row Number The row number in the array where you want the function to look Column Number The column number in the array where you want the function to look INDEX by itself is not that useful because you still need to know the row and column numbers to use it. You usually combine it with the MATCH function, which searches for data in a specific row or column and then returns its relative position. The syntax is: =MATCH(Lookup Value, Lookup Range, Match Type [normally 0 for Exact Match]) MATCH Argument Name Lookup Value Lookup Array Match Type Description Notes The value you are looking for; your known value. The range of cells in which you are looking 1 = less than 0 = exact match -1 = greater than Can be hard coded if you use quotes or can be a cell reference. This is an optional argument. However, if you don’t enter an argument, Excel will assume that the value is 1, or less than. A best practice is to hard code a 0 for exact match. When using these functions together, you need to make sure that the “size” of the Lookup Array in the MATCH function is the same as the size of the Array in the Index function. For example, if the Range in the INDEX function is 20 rows x 30 columns, then any column that you pass into a MATCH function that’s used in this INDEX function must also have 20 rows, and any row must have 30 columns. Practice with INDEX and MATCH: Let’s use INDEX/MATCH as an alternative method for entering the client’s city: Add a column in the Clients sheet for the client’s city. In the first row, enter an INDEX/MATCH function below and copy it to the other rows. Syntax: =INDEX(range,MATCH(lookup_value,lookup_range,match_type)) The range is the value you want inserted into the cell. Then Match on the zip code attribute between the two spreadsheets. Note the City in the zipcodes.csv file has a column header label of Place Name. =INDEX(zipcodes.csv!$B$2:$B$43583,MATCH(D2,zipcodes.csv!$A$2:$A43583 ,0)) Or =INDEX(zipcodes.csv!$B:$B,MATCH(D2,zipcodes.csv!$A:$A,0)) Introduction and Practice with XLOOKUP: XLOOKUP was introduced in a recent version Excel included as part of Microsoft 365. This function is quickly replacing XLOOKUP, HLOOKUP, and INDEX/MATCH formulas due to it’s flexibility and applicability to most situations you’ll find in datasets. Syntax: =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode]) Again, keep in mind that the arguments found in brackets are optional. XLOOKUP Argument Name Lookup Value Lookup Array Return Array If Not Found Match Mode Search Mode Description The value you are looking for; your known value. The range of cells in which you are looking This is the range that you want to return as your result. This gives you the option to specify what you would like returned if there is no match in your look-up. There are various match modes built into this function. This allows the users to specify the order in which they would like to search the Lookup Array. Notes This eliminates the need for an IF and ISNA statement to specify what the user would like returned if no value matches. Typically, use 0 for your match type, as we most often would like an exact match. Beyond the scope for this course. Create an additional column in the Clients tab and enter a formula using an XLOOKUP function to return the client city once again. In your new column, enter the following formula: =XLOOKUP(D2,[zipcodes.xlsx]in!$A:$A,[zipcodes.xlsx]in!$C:$C,"City Not Listed") This will get you the same results as the other methods. However, you’ll notice that this specific formula will return the value “City Not Listed” if there is no match in the lookup, which is not an option with other lookup formulas without other nested functions. Pivot Tables To determine how much money OPA has made on each client, you need the data from the “Jobs” worksheet, but there are a lot of contracts listed here. OPA has been fortunate to have repeat jobs with existing customers. Calculating revenue per client could be done several different ways – many of which would be pretty time consuming. Pivot Tables make this a quick and streamlined task. Pivot tables are powerful tools that allow you to change the way you analyze your data easily because the columns and rows are interchangeable (hence the name “pivot table”). Navigate to the Jobs tab of the workbook. Select Insert from the Ribbon menu and then select Pivot Table Selecting Pivot Table will automatically include all the data on your selected spreadsheet. If that does not happen, you can select the data range needed within the dialogue box. In the dialog box select the option to place the pivot table in a new worksheet Excel will then take you to the newly created worksheet where you can build your pivot table. You set up your pivot table using the options in Pivot Table Fields menu on the righthand side of the screen. Notice that you now have a new menu item on your menu ribbon at the top. It is labeled Pivot Table Analyze. For this task, we want the sum of contract prices by client: Select “client code” and put it in the “rows” box Select “contract price” and put it in the “values” box You can format these numbers into $$ in field settings o In the Values field, click on the drop-down box next to Sum of Contract Price o Select Value Field Settings o Select the Number Format box, which is in the bottom left corner of the Value Field Settings pop up box o Select the appropriate formatting What if you also want to show the percentage of the total portfolio made up by each client? o Select “contract price” and put it in the Values box (this will be a duplicate instance of contract price in the Values box) o In the Values field, click on the drop-down box next to Sum of Contract Price and choose Value Field Settings from the dropdown menu o Once in the Value Field Settings dialog box, select the Show Values As heading o Using the drop-down menu, select % of Grand Total o Use the Number Format box to make sure it’s formatted as a percentage. What if we are only interested in contracts for which we’ve collected payment? You can use the filter to select only those values. Want to break it down by year? We *could* easily add column headers to do that if we had the data in the Jobs worksheet. o Let’s create a new column in the Jobs worksheet that shows the year the contract fees are collected. Select the Data menu on the Ribbon Select Text to Columns Break the “payment collected” column apart by “/” and do not import month or day Place the result in a new column and you should only have a year. Hint: check out these Excel formulas which extract data elements from text strings: MONTH, YEAR, DAY) o Return to the pivot table to add year. What will you need to do to include that data in the pivot table? (Hint: Pivot Table Analyze, Change Source Data). You may also need to refresh the data to update the pivot table. You may need to re-order the Rows boxes in order to sort based on year. Inserting Hyperlinks You can create hyperlinks to navigate between sheets in your workbook or external to your workbook. You are going to end up with some spreadsheets this semester in class that have multiple tabs, and instead of using the arrows to scroll back and forth, you can create hyperlinks, or shortcuts, to move from worksheet to worksheet. You may find that including hyperlinks in your files gives you a better method for navigation. Sometimes with many worksheets in your Excel file, it's nice to include a table of contents so you know what the different worksheets are and then you can hyperlink your table of contents to that exact spreadsheet. Let’s practice creating hyperlinks. Create a new tab in your spreadsheet titled “Table of Contents”. On this tab, create a list of each tab within your spreadsheet. For your first tab (Employees), right-click in the cell and select the Link option (at the very bottom of the drop-down menu) o On the left-hand side of the Insert Hyperlink dialog box, select the Place in This Document option. o You can specify the tab that you want to reference as well as the exact cell reference where you want the hyperlink to go. o For this exercise, specify cell A1 in Employees Repeat adding hyperlinks for the other tabs. o Note that you don’t have to type in the name of the sheet before creating a hyperlink. You can select a blank cell, create a hyperlink, and specify the text to display in the link in the dialog box. Supplemental Information – Spreadsheet Risk Studies have shown that nine out of ten spreadsheets suffer some error, and the consequences can be severe. Examples: http://www.eusprig.org/stories.htm or Eight of the Worst Spreadsheet Blunders (cio.com) Supplemental Information – Debugging Spreadsheets By Rayman Meservy and Marshall Romney, CPA Journal of Accountancy, November 1, 2015 http://www.journalofaccountancy.com/issues/2015/nov/how-to-debug-excelspreadsheets.html Checks/Controls You Can Perform On Spreadsheets Data Entry Controls Field check Sign check Limit check Range check Validity check Characters are proper type (numeric, text, date) Appropriate arithmetic sign (positive/ negative) Tests value against fixed digit Tests value against range of values Compares the ID code or account in transaction data with master file data (ex. product #'s) Reasonableness test Compares value to a reasonable standard Close looped verification Checks the accuracy of input data by using it to receive and display other relevant info Unit cost should be a number Unit price should be positive Regular hours worked less than or equal to 40 Employees are >18 and <65 Does the product number included on an invoice exist in the master inventory listing? Is a chosen vendor on the approved vendor Masterfile? Depreciation expense should not exceed FA values When the AR clerk enters the customer # of the customer who remits a payment, the system returns the customer’s name. Batch Processing Data Entry Controls Sequence check Batch totals Financial total Hash total Record total Tells you if a number in a sequence is missing Sums up numbers in a given batch of transactions Sums up a (meaningful) set of financial data Sum of actual or arbitrarily assigned numerical values computed as a verification that all transactions were processed. Counts the number of records Think about all of those prenumbered documents! All of the payroll processed on 9/15/2015 Total value of the gross pay column Sum of employee Social Security numbers to make sure all (and only) valid employees are paid Total number of employees who are paid in a pay period Processing Controls Cross footing balance test Checks to see that the sum of the sum or each columns = the sum of the sum of each rows The sum of sales for each month (column data) = sum of the sales by customer (row data) When you receive a large data file, you will first want to “get to know it.” Look at the data. Identify the fields (data items) that have been collected. Count the records. Sum the columns. Does it reconcile to any other document? Are there any data anomalies?
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )