Excel for Property Professionals Kyleigh Perkins, CPPS Agenda • Excel is a powerful instrument for manipulating data. We’ll touch on some of the most valuable tools in this presentation: – – – – – – – Some vocabulary Filters & sorts SUBTOTAL vs. SUM Pivot tables VLOOKUP Conditional formatting IF • Before we are done, I’ll leave you with some simple tricks to increase your efficiency when working in Excel. Vocabulary • Formula – tells Excel to perform a calculation or other computation as opposed to just displaying what was typed into the cell – Formulas always start with = to tell Excel to look for a formula – Can be as simple as =1+1 • Parameter – the inputs to a formula, defined for each named formula – Each parameter will give you an indication of the data to be provided – Separated by commas – =DATE(year, month, day) • Range – a selection of cells, sometimes also referred to as an array – Written as the first cell, colon, last cell (top left to bottom right) – Click & drag to select – “A1:Z500” Imagine this scenario… • Your boss or your boss’s boss asks: “What dollar value of government property do we have on hand at that new location? I need it in 15 minutes for a meeting.” • You download data from your property system to Excel, now what do you do? Auto Filter • On the Data ribbon, click Filter. Now you can filter on each column to select the data that you want. Auto Filter • You can even filter on colors! Sorting • Auto filter is great for sorting too! Back to the scenario… • Your data is filtered to show only the data that you want to sum. Now what? =SUM([range]) • How about SUM? • In the last cell of the column to be summed, enter =SUM( then select the cells to be added and press enter. =SUM([range]) • 1 billion dollars!? That can’t be right! -- No, it’s not. • SUM includes all values in the range, irrespective of filters • Now what? =SUBTOTAL(function_num, [range]) • That’s where SUBTOTAL comes in! Subtotal will perform the calculation specified on the data filtered-to only. • The FUNCTION_NUM parameter of the SUBTOTAL function specifies the calculation to perform on the data within the range. We’ll use ‘9’ for SUM, but 3 for COUNTA (number of non-blank cells) is very useful as well. =SUBTOTAL(function_num, [range]) • To use SUBTOTAL, enter =SUBTOTAL(, select the function number that corresponds to the calculation to be performed, enter a comma, select the range to calculate against, and press enter. • In this case, it will look like =SUBTOTAL(9, H1655:H29995) But wait, you’re not done yet… • You turn in your number, and your boss is impressed that you got it done so quickly. Except, now he needs it broken out by Government contract. In ten minutes. • How will you break out your data by contract number? Pivot Tables • Pivot tables are unbelievably powerful tools to analyze data. They allow a number of functions to be performed on data, based on what fields are determined for the rows, columns, etc. • Ensure that a field within your data is selected, then on the Insert ribbon, click PivotTable. (Filters can be on or off. Pivot tables aren’t affected by filters on the data.) Pivot Tables • Excel should come up with the range appropriate for your table in the popup box. Click OK. Pivot Tables • A new sheet opens with a blank pivot table. Somewhere to the right will be the PivotTable Field List. If it doesn’t show up for some reason, first click in the pivot table and then click the Field List button on the Options ribbon. Pivot Tables • • We want a sum of values of government property based on the contract and location. We will use the Report Filter section to filter just like we did with the auto filter. I’ll drag the Ownership Code and MaintPlant fields to the Report Filter section. Pivot Tables • I now have drop-down boxes in the top left of my pivot chart area. Click the Select Multiple Items option from the drop-down to select more than one data option at a time. Pivot Tables • We want to see the data broken out by contract number, so I will drag the Contract Number field to the Row Labels section. Pivot Tables • Finally, we have to tell Excel what field we want to calculate against. In my case, I want the AcquistnValue field. I will drag it to the Values section. Pivot Tables • And there it is, the data we needed in a few mouse clicks. • There are some further things we can do: – – – – Number formatting Column labels Additional rows Group Selection button on the Pivot Table Options ribbon • If at any time you lose the Field List, first click in the pivot table, then if you still don’t see it, click the Field List button on the Options ribbon. • If the source data changes, the pivot table needs to be “refreshed” by clicking Refresh on the Options ribbon (when the pivot table is selected). Congratulations! • Now that you’ve mastered how to summarize and report data, you’ve become the office Excel guru! • Next your boss comes to you with two lists and wants to know what items are on one list that aren’t on the other. • How will you compare two lists? =VLOOKUP(Compare, Source, Column, Approx?) • That’s what VLOOKUP is for! • Let’s break that formula down… – Compare = the data that is consistent between the two lists; most often in Property that will be the equipment/tag or material number – Source = the other list, starting with the column the contains the matching data and going out as far as the data that you want to compare to – Column = a numerical indicator of which column in the source data you want to compare, with 1 being the first column selected in the source, 2 being the second column and so on… – Approx? = are you okay with an approximate match of your lookup value?, if so enter “TRUE”, if not enter “FALSE”; in Property, you will almost always want FALSE =VLOOKUP(Compare, Source, Column, Approx?) • • • Let’s try that with real data… I want to know what items are on the list on the left that aren’t on the list on the right. In the list on the left, I’ll type =vlookup( then click on the equipment number. Then a comma. , , =VLOOKUP(Compare, Source, Column, Approx?) Now, I need to tell it where I am looking for that number, starting with the column that would contain that number. I’ll click on the listing on the right, starting with the equipment number column and going to the end of table. Then type a comma. Notice that Excel created the range reference in my formula with $s. ‘[NES List B.xlsx]Sheet1’!$A$2:$C$17 -- We’ll come back to that. , =VLOOKUP(Compare, Source, Column, Approx?) Next, Excel wants to know which column from the right to bring over to the data on the left. “1” will return the equipment number, “2” will return the equipment class, and “3” will return the acquisition value. I just want to know if there is a match, so I will put “1” to return the equipment number. Type another comma. , , =VLOOKUP(Compare, Source, Column, Approx?) Finally, I need to tell Excel if I want an approximate match or an exact match. I want to know if the record exists in both places, so I need an exact match. I type FALSE (small letters are okay) and then enter (Excel will close the parenthetical). That record is in both lists, so Excel returned the matching equipment number. =VLOOKUP(Compare, Source, Column, Approx?) • Now I will copy the formula down to all of the rows in the list on the left. – Copy, highlight the cells to the bottom of the list, paste – Drag down the tiny box at the bottom right of the cell highlight box or – Highlight the cells in column D from the top to the bottom of the list and press CTRL+D • • Excel dynamically changes each row to pick the equipment number for that row. Remember those $s in the formula when we selected our source? If they were not there, Excel would also change the source range when the formula is copied to additional rows. – Having the two lists in different Excel workbooks will cause Excel to create the reference with the $s. – You can manually add them. Or use F4 when editing a formula to toggle between dynamic and absolute references. =VLOOKUP(Compare, Source, Column, Approx?) • • #N/A indicates that VLOOKUP couldn’t find a match within the range that was specified. In our case, this is what we are looking for! These are the records that are in list A that are not in list B. Other errors with VLOOKUP: – #REF! indicates that the column number indicated is outside the range provided in the source. In this example, 4 or anything larger than 3 would return this errror. – Numbers stored as text: if one list has numbers stored as numbers (data on the right side of the cell) and the other has numbers stored as text (data on the left side of the field), VLOOKUP won’t see those values as the same. – Microsoft has a great reference for troubleshooting VLOOKUP: http://officeimg.vo.msecnd.net/enus/files/397/327/AF102038056.pdf =VLOOKUP(Compare, Source, Column, Approx?) • For a bonus, here’s what I get when my column parameter = 3. This is useful for comparing elements within a record, not just whether the same item is in two different lists. Had enough? • Those #N/A errors are pretty unsightly. What if you wanted to take them out? • How would you remove the #N/A errors? =IF(logical test, true result, false result) • IF returns two different results for each field depending on a true/false condition in the first parameter. • To get Excel to look past the #N/A result, we’ll use another formula, ISNA. • ISNA(VLOOKUP(A2, ‘[NES List B.xlsx]Sheet1’!$A$2:$C$17, 1, FALSE)) will return “TRUE” if the VLOOKUP returns a #N/A error and “FALSE” if it returns an actual value. =IF(logical test, true result, false result) • Now let’s put those two formulas together: • =IF(ISNA(VLOOKUP(A2, ‘[NES List B.xlsx]Sheet1’!$A$2:$C$17, 1, FALSE)) , “Not Found”, “Found”) • In words: if the VLOOKUP doesn’t find a match, return Not Found. If it does find a match, return Found. I frequently build IF statements in layers like this, starting with the VLOOKUP and building out from there. Almost done… • The Not Found cells don’t stand out very much. • How would you make the Not Found cells stand out? Conditional Formatting • Conditional formatting changes the formatting of a cell based on the data within the cell (or based on a referenced cell). • Highlight the cells to apply the formatting to and click Conditional Formatting on the Home ribbon. Conditional Formatting • The options within the conditional formatting drop down are extensive. We’ll choose Highlight Cells Rules and Text that Contains… • In the pop-up box, type No Match in the text box and on the right, select the desired formatting type. Select custom format to open the entire Format Cells dialog box. Tricks & Tips • I promised some tricks before we part! – – – – Paste Values Freeze Panes Customize your Quick Access Toolbar Keyboard Shortcuts Paste Values • You might not want the formulas to continue to be in your spreadsheet, especially with VLOOKUP, where the second data set might get separated from your data. • Paste values will replace a cell containing a formula with the result of that formula. • First, select the cells to replace, copy, then select paste values from the paste drop down. or Freeze Panes • Want to scroll down without losing your titles in your first row? Click Freeze Panes from the View ribbon and select Freeze Top Row. Customize Your Quick Access Toolbar • You can add frequently-used commands to your Quick Access Toolbar to the top right of the Office button. • Click the drop down and select More Commands… Here are some that I strongly suggest: Pivot table(Insert Tab) Filter (Home Tab) Clear Filters (Home Tab) Keyboard Shortcuts • Some of my favorite keyboard shortcuts: – CNTL+arrow key – jumps to the end of the data in the direction selected • For example, CNTL+down arrow will move the cursor to the last cell in the column with data (which may or may not be the end of the column) • Can be combined with SHIFT for extra impact (for example, for selecting a range) – – – – – – CNTL+C – Copy CNTL+V – Paste CNTL+Z – Undo CNTL+Y – Redo (undo an undo) CNTL+D – Copy first cell from selection to all cells selected CNTL+S – Save Further Information • Suggested sources for more information: – Google – Look up a specific formula, or even just something you wish Excel would do, for example “excel difference between two dates” – Books from the library – Excel’s help (F1) Questions? • For more information, you can contact me at: • kyleigh.g.perkins@ulalaunch.com • 303.269.5539