Excel_Training

advertisement
Excel Training – (2)
Using lookups
1)
MATCH function
The MATCH function searches for a value in an array (list) and returns the relative position
of that item. It is a useful way of translating text (e.g. GCSE grades) into numeric values
which can then be used in a formula.
The syntax for the Match function is:
Match( value, array, match_type )
value is the value to search for in the array.
array is a range of cells that contains the value that you are searching for.
match_type is optional. It is the type of match that the function will perform. The possible values are:
match_type
Explanation
1
The Match function will find the largest value that is
(default)
less than or equal to value. You should be sure to sort
your array in ascending order.
If the match_type parameter is omitted, the Match
function assumes a match_type of 1.
0
The Match function will find the first value that is
equal to value. The array can be sorted in any order.
-1
The Match function will find the smallest value that is
greater than or equal to value. You should be sure to
sort your array in descending order.
(Use O:/Student/Training/Match.xls)
We are going to use the example of working out the value added for a GCSE group where we
have target grades and actual grades for each pupil.
Page 1
Into column D we are going to add a formula that changes the predicted grades into numeric
values
=MATCH(B3,{"A*","A","B","C","D","E","F","G"},0)
You can then copy this formula into all the cells in column D.
Into column E we are going to add a similar formula that will change the actual grades into
numeric values
Page 2
=MATCH(C3,{"A*","A","B","C","D","E","F","G"},0)
We now have two sets of numeric values which make it easy to work out the value added in a
further formula. In column F, we can have a simple formula
=E3-D3
You could also add a formula to work out the average value added at the bottom of column F
=AVERAGE(F3:F24)
Alternatively, click on the cell where you want the average then click on the drop down next
to the Σ sign on the toolbar at the top of the page. Choose average and then choose the data
you want to include.
Rather than using a string of values to match against, you can also specify a range of cells to
look at. So, the syntax would look like:
=Match(A4,$D$2:$D$7,0)
This is saying match the value in cell A4 with the values in cells D2 to D7 and return the
position number of the value (this is like a look up table).
2)
VLOOKUP function
Page 3
The VLOOKUP function searches for a value in the left-most column of a table-array (you
define where this is) and returns data from the same row (you tell excel which piece of data
you want).
The data in the lookup table must be ascending order.
The syntax for the VLookup function is:
VLookup( value, table_array, index_number, not_exact_match )
value is the value to search for in the first column of the table_array.
table_array is two or more columns of data that is sorted in ascending order.
index_number is the column number in table_array from which the matching value must be returned. The first column is 1.
not_exact_match determines if you are looking for an exact match based on value. Enter FALSE to find an exact match.
Enter TRUE to find an approximate match, which means that if an exact match if not found, then the VLookup function will
look for the next largest value that is less than value.
(Use O:/STUDENT/TRAINING/Vlookup.xls)
We are going to use a lookup that helps us translate the average points score (APS) at key
stage 2 into predicted GCSE grades (note the data is fictitious). The lookup table contains
data for more than one subject.
We are going to use the lookup table to automatically update column F with the predicted
grade for Art.
Page 4
=VLOOKUP(E3,$K$32:$O$38,3,FALSE)
The value in cell E3 is the one we are trying to match with in our table.
We have defined our table as being is the area K32:038 (We need to $ signs otherwise when
we copy the formula into other cells the excel will cleverly alter the cell reference but we
want them fixed).
The “3” tells excel which column of data we want to use.
If we wanted a different subject then we could just change the “3” to the relevant number
for that subject.
If you’re happy with formula then you can copy it into each cell in the column.
You can also have the LOOKUP table on a different page.
The look up table is also on the sheet called LOOK UP
=VLOOKUP(E3,'LOOK UP'!$A$4:$E$10,4,FALSE)
So the syntax changes slightly with the name of the sheet coming before the cell references
for that table.
Page 5
3)
HLOOKUP function
The HLOOKUP function is identical as the VLOOKUP except that the lookup table is set up
horizontally rather than vertically.
Conditional Formatting of Cells
You can use conditional formatting to highlight cells in your spreadsheet. A spreadsheet
which is just full of numbers can be difficult to interpret. You can use conditional formatting
to draw attention to specific items.
In Excel 2003 you can apply three levels of conditional formatting to a cell (in Excel 2007 I
think this has been increase to 7).
1)
Adding simple conditional formatting to a cell.
(Example we want to flag up all pupils who scored under 45 in a test)
Use O:/Student/Training/Conditional Formatting 1.xls
Start by putting the formatting rules in cell B3.
Left-click on cell B3 and then click on FormatConditional Formatting
Page 6
The following dialogue box will appear
We are now going to specify our rule for the cell
Cell Value is
Less than
46
Page 7
And then we are going to choose our format.
Then click on OK.
(In our example the first cell will remain white as the value is more than 45. If we change it
from 60 to 30 then it should go red).
If you are happy with the formatting, you can copy it to the remainder of the cells in the
column by clicking on the cell (B3) then click on the Format Painter (the paintbrush). Then
“paint” the cells where you want this format.
Page 8
2)
Adding further levels of conditional formatting.
We are going to adjust the formatting so that scores over 70 are green, between 46 and 70
are yellow and below 46 are red.
Click back on cell B3 and then FormatConditional Formatting.
The existing rule(s) will be shown.
We want to add further rules.
Page 9
Click on Add>>
Add our first new rule
Cell Value is
Between
46 and 70
Choose format (yellow)
Then click Add>> again to add our second new rule
Cell Value is
Greater than
70
Choose format (green)
Copy the conditional formatting to all cells by using the Format Painter.
Page 10
(You can experiment with the different options available within Conditional Formatting)
Here is an example where we have compared the value in one cell with that in another to
create progress traffic lights.
3)
Conditional formatting – comparing the value in different cells.
(Use O:/Student/Training/Conditional Formatting 2.xls)
Page 11
We are going conditional formatting to highlight pupils whose scores have gone down from
Score 1 and Score 2.
Click on C3 (the first cell you want to format), click on FormatConditional Formatting
Our rule will be:
Cell Value is
Less than
=b3
Choose a format (such as red)
Copy the format to all cells in the column.
Page 12
Creating Pivot Tables (Two-way tables)
(Use O:/Student/Training/Pivot Table.xls)
Click anywhere on the data in your spreadsheet
Click on Data  PivotTable and PivotChart Report…
Page 13
Now use the wizard to create your chart
1)
2)
4)
Click Next >
Define the boundaries of where your data is (Excel will have made an attempt at
this)
Decide where you want the table to appear (either on the existing page or the
current page)
Then click on Layout …. to get the items on your table
5)
You will then be given a template to fill in
3)
Page 14
6)
Drag and drop the items you want to appear in the columns and rows.
7)
At the moment to value shown in the table will be “Sum of NCT level” which is not
sensible. To change click on the box and then change it to Count.
8)
Click on OK to create your chart.
Page 15
To amend an existing table – right click on the chart and then select PivotTable Wizard.
Creating Charts
Use O:/Student/Training/Chart.xls)
1.
Select the cells that contain the data that you want to display in your chart.
2.
On the Insert menu, click Chart to start the Chart Wizard.
Page 16
3.
In the Chart Wizard - Step 1 of 4 - Chart Type dialog box, specify the chart type that you want to use for
your chart.
4.
Click the Standard Types tab. To view a sample of how your data will look when you select one of the standard
chart types that Excel provides, click the chart type, click the chart subtype that you want to view, and then click
Press and Hold to View Sample
5.
To select a chart type, click the chart type, click the chart subtype that you want, and then click Next
6.
In the Chart Wizard - Step 2 of 4 - Chart Source Data dialog box, you can specify the data range and how
the series is displayed in your chart.
If the preview chart appears the way that you want, click Next.
If you want to change the data range or series for your chart, do any of the following, and then click Next.
o
On the Data Range tab, click the Data Range box, and then select the cells that you want on your
worksheet.
o
Specify whether you want the series displayed in columns or rows.
o
On the Series tab, add and delete a series, or change the worksheet ranges used for the names and
values for each series in your chart.
7.
In the Chart Wizard - Step 3 of 4 - Chart Options dialog box, you can modify the appearance of your chart
more when you select any of the chart option settings on the six tabs. As you change these settings, view the
preview chart to make sure that your chart looks the way that you want.
When you finish selecting the chart options that you want, click Next.
8.
o
On the Titles tab, you can add or change the chart and axis titles.
o
On the Axes tab, you can set the display options for the primary axes of your chart.
o
On the Gridlines tab, you can display or hide gridlines.
o
On the Legend tab, you can add a legend to your chart.
o
On the Data Labels tab, you can add data labels to your chart.
o
On the Data Table tab, you can display or hide data tables
In the Chart Wizard - Step 4 of 4 - Chart Location dialog box, select the location in which to place your chart
by doing one of the following:
o
Click As new sheet to display your chart as a new sheet.
o
Click As object in to display your chart as an object in a sheet.
o
Click Finish
Page 17
Page 18
Download