Excel: Linking sheets and summary sheets (Mac OS) To make the content of one cell appear somewhere else Click in the destination cell and type = Click on the cell whose content you want to pull in and press ENTER To build formulae across worksheets Start to build your formula When a cell reference from another sheet is required, simply click to select the required worksheet, then click on the cell you require You will lose visibility of the formula in the worksheet, so continue building the formula in the formula bar at the top of the worksheet. To build formulae across Excel files Open all the Excel files to be used in the formula and view them on the screen together using Window >> Arrange (see previous section) Click where you want your formula to appear and start to build the formula When a cell reference from another file is required, click anywhere on the file to activate it. Click to select the required worksheet, then click on the cell you require Continue building the formula in the formula bar at the top of the worksheet. File names will appear in the formula as [filename.xlsx] Worksheet names will appear in the formula as worksheetname! To view multiple Excel files on the screen together Useful when building formulae across workbooks: Open the files in Excel On the Window menu, click on Arrange. Choose your preferred option (e.g. Horizontal) and click OK. The Excel files will all be visible on the screen. Only one will be active at any one time. The active workbook can be identified by: the ribbon above the sheet will not be greyed out. the Maximise, Minimise and Close buttons at the top left of that workbook will not be greyed out. Moving chart location e.g. to make them appear alongside other data on a summary sheet: Click on the chart to select it Copy the chart ( +C) Click on the sheet where you want to put the chart. Paste the chart ( +V). Hiding grid lines e.g. to build a summary sheet that looks a bit like a dashboard: Click on any cell in the worksheet. Click on Excel > Preferences Click on View Uncheck Show gridlines and click OK. Last updated April 2015 Information Services documents are online at: https://staff.brighton.ac.uk/is/training 1 Faye Brockwell
Autofill to copy formula to other cells Select the cell(s) you want to copy. The fill handle will appear at the bottom right of the selection Point at the fill handle until it becomes a cross. Click and drag to copy the data OR double-click to autofill all rows. Click on to change the type of fill (series, copy, formula only etc.) Absolute cell referencing to avoid problems when autofilling Absolute cell references are used when a formula references a cell/cells that must remain the same even when a formula is copied to other cells in the worksheet (e.g. using autofill).to make a cell reference absolute: Double click on the cell containing the formula Click once on the cell reference in the formula bar Press +T until cell reference meets your needs (see below) Original cell reference... D2 $D2 D$2 $D$2...when copied becomes E4 $D4 E$2 $D$2 Effect Both the column and the row coordinates change as the formula is copied The column coordinate is fixed, but the row coordinate changes The column coordinate changes, but the row coordinate is fixed. Both the column and row coordinates remain fixed Naming worksheets Naming your worksheets makes Select it easier the cell(s) to read you formulae want to copy. across The fill worksheets or files. Use short handle names. will appear at the bottom right of the Double click on the worksheet s selection tab at the bottom of the screen (e.g. Point Sheet1) at the fill handle until it becomes a cross. Type the new name of the worksheet and press ENTER. Cl Cl Note, this step is NOT the same as naming a cell range to use in a formula such as VLOOKUP. Adding cell borders This is useful when printing a worksheet or if you have hidden the gridlines on a worksheet to create a dashboard. Select the cells that you want to add the borders to. On the Home tab click on drop down arrow on the Border button Click to choose All Borders Name cells or ranges This technique can be used as an alternative to using absolute references when building VLOOKUP functions Select the cell or range you want to name Click in the Name box and type the name. Press ENTER To use, simply type the name wherever you would use a cell or range reference in a formula. E.g. =SUM(Wages) 2
Using VLOOKUP to pull data from another table Where several spreadsheets use the same data, it is useful to have one master sheet holding that data and then allow the other sheets to reference that information using the VLOOKUP function. This allows you to maintain data centrally. Any updates will automatically update the other sheets. VLOOKUP is also useful where the data you want is held in 2 or more tables downloaded from CAMS and you want to link them together or compare them. In the example below, a VLOOKUP in column K uses the mark in column J to locate the corresponding grade in the second spreadsheet. Preparing your data for VLOOKUP For VLOOKUP to work: the master lookup table must be sorted by the key field (i.e. the field common to both tables). The master lookup table can be identified as the table with unique values in the key field column, ie each value only appears once. It is also useful (but not essential) to name the lookup table as it makes it simplifies the build of VLOOKUP formula. 3
Building the VLOOKUP The format of the VLOOKUP function is: =VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) The key field on the current sheet. i.e. the cell containing the text or value in the current sheet that you want to check for in the other table Lookup_value Usually a cell reference on the same worksheet and in the same row as where you are building the VLOOKUP In our example on the previous page, the Mark is the key field as it is the value that appears on both tables. The name or cell range of the master table you want to check against. Table_array The first column in the range must contain the key field where you will look for the lookup_value. The table must be sorted on the key field. Cell references should be made absolute using $ signs (or you can name the table beforehand). The number of the column in the master table (table_array) containing the text or value that you are looking for (counting across from the first column). Col_index_num Do not use column letters here. In our example on the previous page, the Grade is held in column 2 on the master table. Used to specify whether you are only interested in exact matches or closest matches. Range_lookup Type FALSE to look for exact matches only If no exact matches are found, Excel will display #N/A as the result of the VLOOKUP Leave blank to find closest match. 4
VLOOKUP Example We have this sheet containing student marks: Use insert function (formula builder) to make VLOOKUP easier Start to type your formula until the first bracket e.g. =VLOOKUP( On the formula bar, click on the function button The pop-up window splits the formula into its arguments To select cells to add them to the formula simply select them in the worksheet. And this sheet (called Grades & Check Digits) containing the marks scheme: In cell K2 on the first sheet we have built the VLOOKUP function below to find the correct grade by: searching for the mark in cell J2 on the first sheet in the list of marks on the second sheet, reading across on the second sheet to find the corresponding grade in column 2: =VLOOKUP(J2,'Grades & Check Digits'!$A$2:$C$102,2,FALSE) J2 - We are building a VLOOKUP to find the Grade for Jill Shacklock. We need to check for Jill s Mark Lookup_value from the first table against the list of marks in the second table. Cell J2 contains Jill s mark in the first table. 'Grades & Check Digits'!$A$2:$C$102 Table_array The second table is cells A2 to C102 on the Grades & Check Digits worksheet 2 - Counting from the left on the second table, the Col_index_num Grade we are looking for is in column 2. Range_lookup FALSE - We only want to look for exact matches. MATCH function Match can be used as an alternative to VLOOKUP to check if the content of a cell exists in another table. If MATCH finds a match, it will return the position of the match in the list. If not match is found, #N/A will appear as the result of the formula. The format of the MATCH function is: =MATCH(lookup_value,lookup_array,match_type) The cell reference of the key field in the current row (this is usually on the same worksheet and in the same row as the cell where you are building your VLOOKUP Lookup_value function). i.e. the cell containing the text or value in this row that you want to check for in the other table The name or cell range of the single column in the table lookup_array you want to check against. Cell references should be made absolute using $ signs. Type 0 to look for exact matches only Match_type If no exact matches are found, Excel will display #N/A as the result of the VLOOKUP. 5
Pulling data from a Pivot Table The GETPIVOTDATA function can be used to make the content of a cell in a pivot table appear elsewhere. The function has the syntax: =GETPIVOTDATA("Data_field",Pivot_table,"Field1","Item1") Data field Pivot table Field 1 Item 1 Name of value field from Pivot Table (e.g. the field name that appears in the Values box on the Pivot Table) Cell reference (including worksheet name) of first cell at top left of the pivot table (i.e. the cell containing the text Row Labels) Name of the summary field for the value selected (e.g. the field name that appears in row or column labels box) Value of Field 1 for the desired pivot table sub-total. Example: Referring to the pivot table shown on the right, the following formula: =GETPIVOTDATA("Amount",Sheet1!$A$3,"Project","Sausages") Would pull: the Amount field from the Pivot Table that starts in cell A3 on Sheet1 of our workbook where the Project = Sausages i.e. in our example on the right, this would pull the value 760.85. To make the function more flexible, you can change the Item1 reference to be a cell reference rather than an absolute value. This will allow you to copy the formula down a column using autofill to pick up other Item1 value. E.g. =GETPIVOTDATA("Amount",Sheet1!$A$3,"Project",A2) 6
IFERROR to eliminate error values When using functions such as GETPIVOTDATA or VLOOKUP, the result of the function will be an error if Excel finds no match. This will show in the cell as #REF or #N/A. Such results may cause problems if the data is to be used in a calculation or in conditional formatting. For example, in the sheet below a GETPIVOTDATA function has been used to pull the data in column G from a pivot table on a different sheet. The format of IFERROR is as follows: =IFERROR(value,value_if_error) where: Value is the nested function (e.g. the GETPIVOTDATA function in the example above) Value_if_error is what you would like to appear in the cell instead of #REF! or #N/A if the result of the function is an error. So, in our example above, the GETPIVOTDATA function in cell G2 with the IFERROR wrapped around it would look like this: =IFERROR(GETPIVOTDATA("Amount",'Pivot table by project'!$a$3,"project",a2),0) Cell G2 contains the function (which has then been copied down column G): =GETPIVOTDATA("Amount",'Pivot table by project'!$a$3,"project",a2) The result of this function in cell G3 is #REF! as there is no data in the pivot table for that project. This causes a problem for the total in cell G8 as #REF! is not a number. The text in red above is the original GETPIVOTDATA function. All that has been added to that function is: IFERROR( between the = and GETPIVOTDATA,0) at the end of the GETPIVOTDATA function (after the closing bracket) When copied down the column, in the example above, G3 shows as a numeric value, which in turn resolves the problem with the total in G8, as shown below. To avoid this problem, the IFERROR function is used. IFERROR is added as a wrapper around another function. If the result of the nested function is FALSE, IFERROR replaces the resulting #REF! or #N/A with a value that can then be used in calculations or conditional formatting. 7