Microsoft Excel 2010

Advanced

Contents
Apply or remove cell borders on a worksheet........................................................................................ 4
Apply a predefined cell border ........................................................................................................... 4
Remove a cell border .......................................................................................................................... 5
Create a custom cell border ................................................................................................................ 6
Apply a custom cell style..................................................................................................................... 8
Change the colour of gridlines in a worksheet ....................................................................................... 9
Print gridlines in a worksheet ............................................................................................................... 10
Apply conditional formatting ................................................................................................................ 11
The benefits of conditional formatting ............................................................................................. 11
Format all cells by using a two-colour scale ................................................................................. 11
Format all cells by using a three-colour scale ............................................................................... 12
Format all cells by using data bars ................................................................................................ 13
Format all cells by using an icon set.............................................................................................. 14
Format only cells that contain text, number, or date or time values ........................................... 14
Format only top or bottom ranked values .................................................................................... 15
Format only values that are above or below average .................................................................. 16
Format only unique or duplicate values ....................................................................................... 17
Use a formula to determine which cells to format ....................................................................... 17
Find cells that have conditional formats....................................................................................... 19
Clear conditional formats ............................................................................................................. 20
Customise the Ribbon ........................................................................................................................... 21
Get to the Customize the Ribbon window ........................................................................................ 22
Work with tabs .................................................................................................................................. 22
Add a custom tab .......................................................................................................................... 22
Rename a default or custom tab .................................................................................................. 22
Hide a default or custom tab ........................................................................................................ 23
Change the order of default or custom tabs ................................................................................ 23
Remove a custom tab ................................................................................................................... 23
Work with groups ............................................................................................................................. 23
Add a custom group to a tab ........................................................................................................ 23
Rename a default or custom group .............................................................................................. 24
Change the order of the default and custom groups ................................................................... 24
Remove a default or custom group .............................................................................................. 24
2

Replace a default group with a custom group .............................................................................. 24
Work with commands ....................................................................................................................... 25
Add commands to a custom group ............................................................................................... 25
Remove a command from a custom group .................................................................................. 25
Rename a command that you added to a custom group ............................................................. 26
Change the order of the commands in custom groups ................................................................ 26
Reset the ribbon................................................................................................................................ 26
Reset the Ribbon to the default settings ...................................................................................... 26
Reset only the selected tab........................................................................................................... 26
Export a customised ribbon .............................................................................................................. 26
Import a customised Ribbon ............................................................................................................. 27
Using a macro ....................................................................................................................................... 27
Record a macro ................................................................................................................................. 27
Delete a macro .................................................................................................................................. 30
VLOOKUP............................................................................................................................................... 32
VLOOKUP Syntax ............................................................................................................................... 32
Example of using VLOOKUP using a FALSE Range_lookup ............................................................... 33
Example of using VLOOKUP using a TRUE Range_lookup ................................................................ 35

3

or remove a border from. do one of the following: • To apply a new or different border style. Two diagonal border buttons available under Border. Under Presets and Border. Cell borders that you apply appear on printed pages. If predefined cell borders do not meet your needs. On a worksheet. in the Font group. click More Borders. you can quickly add a border around cells or of cells. click the line style and colour that you want. . you can display the gridlines. click the arrow next to Borders Border are . change the border style on. on the Border tab. 4 . click the arrow next to Borders then click a border style. On the Home tab. If you do not use cell borders but want worksheet gridline borders for all cells to be visible on printed pages. click one or more buttons to indicate the border placement. Apply a predefined cell border 1. 2. and To apply a custom border style or a diagonal border. In the Format Cells dialog box. you can create a custom border. and then click No .Apply or remove cell borders on a worksheet By using predefined border styles. select the cell or range of cells that you want to add a border to. under Line and Colour. • To remove cell borders.

On the Home tab. If you want to print the same border on cells that are separated by a page break. A selected range of cells is formatted as a single block of cells. Do the following: 1. 5 . 4. You can click the Borders button (not the arrow) to apply that style. This way. Remove a cell border 1. and then click More Borders. the most recently applied border is displayed.The Borders button displays the most recently used border style. you can apply an inside border. If you apply two different types of borders to a shared cell boundary. but the border appears on only one page. Click the arrow next to Borders . remove the vertical border by clicking it. For example. 3. in the preview diagram. 2. the border is displayed only on the right edge of the cells C1:C5. Select the rows on both sides of the page break. Under Border. if you apply a box border to enclose the range B1:C5. click the Inside button . click the arrow next to Borders Border . On a worksheet. Under Presets. 2. the border is also applied to adjacent cells that share a bordered cell boundary. If you apply a right border to the range of cells B1:C5. you can print a border at the bottom of the last row of one page and use the same border at the top of the first row on the next page. If you apply a border to a selected cell. select the cell or range of cells that you want to remove a border from. in the Font group. and then click No . the cells D1:D5 acquire a left border.

1. in the Styles group. next 2. click Cell Styles. and then apply that cell style when you want to display the custom border around selected cells. In the Style name box. If you do not see the Cell Styles button. 6 . Click New Cell Style. click Styles. type an appropriate name for the new cell style.Create a custom cell border You can create a cell style that includes a custom border. On the Home tab. and then click the More button to the cell styles box. 3.

Click Format. 6. click the border buttons to create the border that you want to use. 7. under Line. 5. click the line style that you want to use for the border. In the Colour box. 7 . in the Style box. select the colour that you want to use.4. Under Border. On the Border tab.

do the following: 1. Click OK. Apply a custom cell style To apply a custom cell style that you have created. Select the cells that you want to format with the custom cell border. 10. under Style Includes (By Example). clear the check boxes for any formatting that you do not want to include in the cell style. In the Style dialog box. Click OK.8. 9. 8 .

Change the colour of gridlines in a worksheet By default. make sure that the Show gridlines check box is selected. If you want gridlines to appear on the printed page. • Print gridlines . you might want to take the following next steps: • Make gridlines more visible . gridlines are displayed in worksheets using the colour that is assigned to Automatic. you can experiment with border and line styles. 4. click Cell Styles. On the Home tab. In the Gridline colour box.To make the gridlines stand out on the screen. 1. in the Font group. select the worksheet or worksheets that you want 9 . under Display options for this worksheet. click the colour you want. To change the colour of gridlines. Select the worksheets for which you want to change the gridline colour. 3. Excel does not print gridlines on worksheets. In the Advanced category. To return gridlines to the default colour. Click Options.By default.2. Click the File tab. 2. in the Styles group. Under Custom. After you change the colour of gridlines on a worksheet. These settings are located on the Home tab. you can use the following procedure. click Automatic. 3. click the cell style that you want to apply. 5.

3. in the Sheet Options group.to print. you can apply borders around the cells that you want to print. • Troubleshoot printing issues with gridlines .To see how the gridlines will print. Gridlines are designed to print only around actual data in a worksheet. press the ALT+P. S. 4. there may be an issue with your printer driver. In this case. If you cancel that selection. If the check boxes in the Sheet Options group appear dimmed. If you want to print gridlines around empty cells as well. The Draft quality check box appears on Sheet tab in the Page Setup dialog box. To print. you can try downloading the latest driver from the printer manufacturer's website. 2. select the Print check box under Gridlines. you'll be able to use the check boxes. in the Sheet Options group. P keys together. or if you can't see them in the Print Preview window. As a last resort. gridlines don't appear on a printed worksheet or workbook by default. press CTRL+F2 to open the File tab. image. In the Print dialog box. Alternatively. Click the File tab.If gridlines don't show up when you print your worksheet. To quickly access the Page Setup dialog box. Select the worksheet or worksheets that you want to print. On the Page Layout tab. click OK. which displays a preview of what your printed worksheet will look like. After you select the Print check box. you may want to take the following steps: • Preview the gridlines . make sure that the Draft quality check box is not selected. and then click Print. 1. you can apply borders around the cells instead. or other object selected on the worksheet. or use the keyboard shortcut which is achieved by pressing CTRL+P. If gridlines still don't print successfully. it may be because you have a chart. you must set the print area to include those cells. 10 . On the Page Layout tab. This article explains how you can make the gridlines appear in your printed worksheets. Print gridlines in a worksheet In Excel. select the Print check box under Gridlines. press CTRL+P.

you can specify that higher value cells have more of a green colour and lower value cells have more of a red colour. You can apply conditional formatting to a cell range. click the arrow next to Conditional Formatting. you can reference only other cells on the same worksheet or. use an IS or IFERROR function to return a value other than an error value. Format all cells by using a two-colour scale Colour scales are visual guides that help you understand data distribution and variation. and icon sets. and then click Colour Scales. including cell colour and font colour. Conditional formatting helps you visually answer specific questions about your data. the conditional formatting is not applied to the entire range. If one or more cells in the range contain a formula that returns an error. On the Home tab. If the condition is true. or PivotTable report. A twocolour scale helps you compare a range of cells by using a gradation of two colours. 1. You can sort and filter by format. Select one or more cells in a range. you can quickly identify variances in a range of values with a quick glance. colour scales. To ensure that the conditional formatting is applied to the entire range. and visualise data by using data bars. whether you have manually or conditionally formatted the cells. You cannot use conditional formatting on external references to another workbook. 11 . For example. in a green and red colour scale. the cell range is formatted based on that condition. or a PivotTable report. The benefits of conditional formatting Conditional formatting can highlight individual or a range of cells. A conditional format changes the appearance of a cell range based on conditions (or criteria). When you create a conditional format. table. emphasise unusual values. cells on worksheets in the same currently open workbook. in certain cases. in the Styles group. if the conditional is false.Apply conditional formatting By applying conditional formatting to your data. 2. a Microsoft Excel table. The shade of the colour represents higher or lower values. the cell range is not formatted based on that condition.

or lower values. 3. yellow as the middle values and red as the lowest values: 12 . Select one or more cells in a range. On the Home tab. 2. and the bottom colour represents lower values. Select a three-colour scale. An example of using a three-coloured scale which has green as the highest values. the centre colour represents middle values. 1. and the bottom colour represents lower values. For example. you will see which icon is a two-colour scale. If you hover over the colour scale icons. and then click Colour Scales. middle. yellow. An example of using a two-coloured scale which has green as the highest values and red as the lowest values: Format all cells by using a three-colour scale Colour scales are visual guides that help you understand data distribution and variation. A threecolour scale helps you compare a range of cells by using a gradation of three colours. middle value cells have a yellow colour. in a green. or PivotTable report. The top colour represents higher values. and red colour scale. and lower value cells have a red colour. click the arrow next to Conditional Formatting. table. Select a two-colour scale. The top colour represents higher values. in the Styles group. The shade of the colour represents higher. If you hover over the colour scale icons.3. you can specify that higher value cells have a green colour. you will see which icon is a three-colour scale.

and a shorter bar represents a lower value. in the Style group. such as top selling and bottom selling products in an annual sales report. 1. especially with large amounts of data. 2. On the Home tab. The length of the data bar represents the value in the cell. table. click the arrow next to Conditional Formatting. Data bars are useful in spotting higher and lower numbers. click Data Bars. Select one or more cells in a range. and then select a data bar icon. or PivotTable report. A longer bar represents a higher value.Format all cells by using data bars A data bar helps you see the value of a cell relative to other cells. An example of using Data Bars with a green gradient fill: 13 .

2. you hide icons by selecting No Cell Icon from the icon drop-down list next to the icon when you are setting conditions. the green up arrow represents higher values. Select one or more cells in a range. in an inventory worksheet sorted by categories. or PivotTable report. and region equal to "South. a yellow "traffic light". displaying a warning icon for those cells that fall below a critical value and no icons for those that exceed it. For example. for example." 1." You cannot conditionally format fields in the Values area of a PivotTable report by text or date. On the Home tab. Each icon represents a range of values. such as Between. and the red down arrow represents lower values. Text that Contains. Format only cells that contain text. sales volumes less than £50. only by number. table. 1.000. in the Style group. in a retail store summary worksheet. Select one or more cells in a range. click Icon Set. 2. To do this. You can also create your own combination of icon sets. Below is an example of using Icon Sets with arrows. or A Date Occurring. you can highlight the products with fewer than 10 items on hand in yellow. Or. or PivotTable report. The green up arrows represent higher values. the yellow sideways arrow represents middle values. You can choose to show icons only for cells that meet a condition. in the Style group. and then click Highlight Cells Rules. click the arrow next to Conditional Formatting. For example. you can format those specific cells based on a comparison operator. yellow sideways arrows represent middle values and the red down arrows represent lower values. 14 . number. click the arrow next to Conditional Formatting. for example. and a red "flag. Select the command that you require. 3. in the 3 Arrows icon set. a green "symbol" check mark.Format all cells by using an icon set Use an icon set to annotate and classify data into three to five categories separated by a threshold value. On the Home tab. Equal To. you can identify all stores with profits greater than 10%. or date or time values To more easily find specific cells within a range of cells. and then select an icon set. table.

Select one or more cells in a range. or PivotTable report. For example. such as Top 10 items or Bottom 10 %. or the top 15 salaries in a department personnel analysis. click the arrow next to Conditional Formatting. Select the command that you want. in the Style group. Enter the values that you want to use. you can find the top 10 selling products in a regional report. 2. table. 1. Format only top or bottom ranked values You can find the highest and lowest values in a range of cells that are based on a cut-off value you specify. 15 . and then click Top/Bottom Rules. 3. the bottom 10% rated products in a customer survey.4. and then select a format. On the Home tab. You can change the method of scoping for fields in the Values area of a PivotTable report by using the Apply formatting rule to option button.

and then click Top/Bottom Rules. Select the command that you want. 1. such as Above Average or Below Average. Select one or more cells in a range. For example. 16 . table. or PivotTable report. 3. in the Style group. you can find the above average performers in an annual performance review or you can locate manufactured materials that fall below two standard deviations in a quality rating. Enter the values that you want to use. Format only values that are above or below average You can find values above or below an average or standard deviation in a range of cells.4. and then select a format. On the Home tab. 2. click the arrow next to Conditional Formatting.

and then click Highlight Cells Rules. Use a formula to determine which cells to format If your conditional formatting needs are more complex. On the Home tab. Enter the values that you want to use. Do one of the following: 17 . in the Styles group. you may want to compare values to a result returned by a function or evaluate data in cells outside the selected range. The Conditional Formatting Rules Manager dialog box is displayed. Select one or more cells in a range. Select Duplicate Values. in the Style group. click the arrow next to Conditional Formatting. you can use a logical formula to specify the formatting criteria. 4. and then click Manage Rules. 2. and then select a format. 3. which can be in another worksheet in the same workbook. Enter the values that you want to use. or PivotTable report. Format only unique or duplicate values 1. table. For example. click the arrow next to Conditional Formatting.4. and then select a format. On the Home tab. 2. 1.

by selecting the new range of cells on the worksheet or other worksheets. Make sure that the appropriate worksheet.• To add a conditional format. change the range of cells by clicking Collapse Dialog in the Applies to box to temporarily hide the dialog box. 2. click Use a formula to determine which cells to format. • To change a conditional format. and then click Edit rule. and then by selecting Expand Dialog 3. The New Formatting Rule dialog box is displayed. Under Edit the Rule Description. do the following: 1. enter a formula. Select the rule. click New Rule. 1. You must start the formula with an equal sign (=) and the formula must return a logical value of TRUE (1) or FALSE (0). table. Under Select a Rule Type. . Optionally. in the Format values where this formula is true list box. 3. 18 . or PivotTable report is selected in the Show formatting rules for list box. The Edit Formatting Rule dialog box is displayed.

The AND function combines multiple criteria. you can quickly locate them so that you can copy. The formats that you select are displayed in the Preview box. Because 0 is FALSE and 1 is TRUE. one conditional format with multiple criteria applied to the range A1:A5 formats the cells green if the average value for all of the cells in the range is greater than the value in cell F1 and any cell in the range has a minimum value greater than or equal to the value in G1. On the Home tab. every odd numbered row is formatted. Click any cell without a conditional format. You can choose more than one format. The MOD function returns a remainder after a number (the first argument) is divided by divisor (the second argument). MIN($A$1:$A$5)>=$G$1) Green cell colour Example 2: Shade every other row by using the MOD and ROW functions This formula shades every other row in the range of cells a blue cell colour. Formula Format =AND(AVERAGE($A$1:$A$5)>$F$1. and the AVERAGE and MIN functions calculate the values. Find all cells that have a conditional format 1. border. font. 19 .Example 1: Use one conditional format with multiple criteria and cell references outside of the range of cells In this formula. Find cells that have conditional formats If your worksheet has one or more cells with a conditional format. or delete the conditional formats. When you divide the current row number by 2. Click Format to display the Format Cells dialog box. Formula Format =MOD(ROW(). change. or fill format that you want to apply when the cell value meets the condition. You can use the Go To Special command to either find only cells with a specific conditional format or find all cells with conditional formats. and then click Conditional Formatting. Cells F1 and G1 are outside of the range of cells for which the conditional format is applied. click the arrow next to Find & Select. in the Editing group. 2. 3. The ROW function returns the current row number. Select the number. you always get either a 0 remainder for an even number or a 1 remainder for an odd number.2)=1 Blue cell colour 2. and then click OK.

and then click Clear Rules from Entire sheet 20 . Clear conditional formats Do one of the following: • On a worksheet 1. 2. Click Same under Data validation.Find only cells with the same conditional format 1. 4. On the Home tab. click the arrow next to Find & Select. Click Conditional formats. Click the cell that has the conditional format that you want to find. in the Editing group. in the Styles group. click the arrow next to Conditional Formatting. and then click Go To Special. On the Home tab. 3.

You can rename and change the order of the default tabs and groups that are built-into Microsoft Office 2010. custom tab. For example. this is specific to this application and is not shared in any other Microsoft Office program. 3. To help you identify a custom tab or group and to distinguish from a default tab or group. table. in the Styles group. or PivotTable 1. In a range of cells. or PivotTable for which you want to clear conditional formats. or change the order of these commands. click the arrow next to Conditional Formatting. However. The default commands appear in grey text. Depending on what you have selected. When you Customize the Ribbon in Excel. Customise the Ribbon Use customisations to personalise the Ribbon the way that you want it. you cannot rename the default commands. This Table. table. and then click Clear Rules. On the Home tab. the 21 . To add commands to a group. 2. you must add a custom group to a default tab or to a new. click Selected Cells.2. you can create custom tabs and custom groups to contain your frequently used commands. change the icons associated with these default commands. Select the range of cells. or This PivotTable. • Click Entire Sheet.

2. Default tab and group that has commands that cannot be changed Custom group in a default tab that has new commands added. In the Customize the Ribbon window under the Customize the Ribbon list. click New Tab. by right-clicking any tab on the ribbon. These new commands can be changed. In the Customize the Ribbon window under the Customize the Ribbon list. and then type a new name. 22 . Work with tabs Add a custom tab When you click New Tab. 3. You can also get to the Customize the Ribbon window. Under Help. 1. see the steps below. but the word (Custom) does not appear in the ribbon. Click Customize Ribbon. you add a custom tab and custom group. 2. and then clicking Customize the Ribbon. Get to the Customize the Ribbon window 1. click the tab that you want to rename. To see and save your customisations. You can only add commands to custom groups. Click the File tab. 2.custom tabs and groups in the Customize the Ribbon list have (Custom) after the name. Rename a default or custom tab 1. click OK. see Add commands to a custom group (as detailed on page 25). Click Rename. To start to customise your ribbon. To add commands to a custom group. click Options.

Work with groups Add a custom group to a tab You can add a custom group to either a custom tab or a default tab. click the tab that you want to remove. Hide a default or custom tab You can hide both custom and default tabs. Click New Group. In the Customize the Ribbon window. You can also add an icon to represent the custom group by clicking the custom group. rightclick the group. click Rename. Change the order of default or custom tabs 1. 4. In the Customize the Ribbon window under the Customize the Ribbon list. click OK. 3.3. To see and save your customisations. To see and save your customisations. 3. click OK. clear the check box next to the default tab or custom tab that you want to hide. 2. Click Remove. and then click Hide Command Labels. To see the labels for the commands in the custom group after you have hidden them. To rename the New Group (Custom) group. Click the Move Up or Move Down arrow until you have the order you want. click OK. 2. 2. 23 . To see and save your customisations. and then clicking Rename. To see and save your customisations. 2. right-click the group. and then type a new name. Remove a custom tab You can hide both custom and default tabs. 1. In the Customize the Ribbon window under the Customize the Ribbon list. In the Customize the Ribbon window under the Customize the Ribbon list. right-click the group. but you can only remove custom tabs. 1. click the tab that you want to move. and then click Hide Command Labels. click the tab that you want to add a group to. 1. 3. To hide the labels for the commands that you add to this custom group. but you can only remove custom tabs. click OK. under the Customize the Ribbon list.

Replace a default group with a custom group You can’t remove a command from a default group. 24 . To see and save your customisations. see Add commands to a custom group (as detailed on page 25). you can make a custom group with only the commands that you want to replace the default group. 3. 2. click OK. 5. Remove a default or custom group 1. 3. and then click Rename. 2. To add commands to a custom group. In the Customize the Ribbon window under the Customize the Ribbon list. While you are renaming a custom group. click the group that you want to move. and then type a new name. click OK. 3. you can also click an icon to represent that group when the ribbon is resized. In the Customize the Ribbon window under the Customize the Ribbon list. Right-click the new group. Click the Move Up or Move Down arrow until you have the order you want. However. 1. 2. Click Rename. click the default tab where you want to add the custom group. Change the order of the default and custom groups 1.5. click the group that you want to remove. Click Remove. click Main Tabs. 3. In the Choose Commands from list. In the Customize the Ribbon window under the Customize the Ribbon list. Type a name for the new group and select an icon to represent the new group when the ribbon is resized. To see and save your customisations. click the tab or group that you want to rename. To see and save your customisations. 2. Rename a default or custom group 1. Click New Group. click OK. click OK. a group built-into Microsoft Office. 4. To see and save your customisations. In the Customize the Ribbon window under the Customize the Ribbon list.

Click Add. You don’t have to add all the commands. you should export them first. Only commands added to custom groups can be renamed. 3. the custom tabs and groups have (Custom) after the name. Instead you can add the ones that you want. You can also rename a command and add an icon to represent the command by clicking the command. Popular Commands or All Commands. for example. 2. Click the command that you want to add to the custom group. see the Replace a default group with a custom group section (as detailed on page 24). Work with commands You can only add commands to a custom group that is under a custom or default tab. Click a command in the list that you choose. and then click Add. Add commands to a custom group In the Customize the Ribbon list. 8. 1. In the Choose commands from list. In the Customize the Ribbon window. but the word (Custom) does not appear in the ribbon. Click the plus sign (+) next to the default group that you want to customise.6. under the Customize the Ribbon list. click the command that you want to remove. Remove a command from a custom group You can only remove commands from a custom group. Click Remove. To see and save your customisations. 5. To see how to update a default group. You cannot add commands to a default group. 9. click the list you want to add commands from. To see and save your customisations. 4. and then clicking Rename. click OK. 2. Right-click the default group. click the custom group that you want to add a command to. Click the plus sign (+) next to the default tab that contains the group that you want to customise. and click Remove. but if you want to use your Ribbon customisations again. 7. You can get the default group back by resetting the Ribbon. 25 . click OK. In the Customize the Ribbon window under the Customize the Ribbon list. 1. 3.

click Reset. select the default tab that you want to reset to the default settings. In the Customize the Ribbon window. 26 . Reset only the selected tab You can only reset default tabs to their default settings. you also reset the Quick Access Toolbar to show only the default commands. you can also click an icon to represent that command. click OK. 2. Reset the Ribbon to the default settings When you click Reset all customizations. Reset the ribbon You can choose to reset all tabs on the Ribbon or only the selected tabs to their original state. click OK. click the command that you want to rename. 2. When you reset all tabs on the Ribbon. 3. Click Reset all customizations. To see and save your customisations. In the Customize the Ribbon window under the Customize the Ribbon list. In the Customize the Ribbon window. and then click Reset only selected Ribbon tab. Change the order of the commands in custom groups 1. Click Rename. Export a customised ribbon You can export your Ribbon and Quick Access Toolbar customisations into a file that can be imported and used by somebody else or on another computer. Click Reset. Click the Move Up or Move Down arrow until you have the order you want. 2. click the command that you want to move. 3. 2. and then type a new name. To see and save your customisations. While you are renaming a command you added to a custom group. In the Customize the Ribbon window under the Customize the Ribbon list. 1. you reset both the Ribbon and the Quick Access Toolbar to the default settings. 1.Rename a command that you added to a custom group 1.

you can quickly record a macro in Microsoft Excel. In the Customize the Ribbon window. you should export them before importing any new customisations. Click the File tab. click Import/Export. By being able to import the customisation. Macros are recorded in the Visual Basic for Applications programming language.1. If the Developer tab is not available. Click Export all customizations. 2. If you think that you might want to revert to the customisation you currently have. In the Customize the Ribbon window. the macro recorder records all the steps required to complete the actions that you want your macro to perform. When you import a Ribbon customisation file. If you no longer use a macro. 27 . 1. A Macro is an action or a set of actions that you can use to automate tasks. 1. After you create a macro. you can assign it to an object (such as a toolbar button. you can keep Excel looking the same as your colleagues or from computer to computer. Navigation on the Ribbon is not included in the recorded steps. do the following to display it: 1. and then click Customize Ribbon. click Import/Export. Using a macro To automate a repetitive task. 2. Click Options. graphic. Import a customised Ribbon You can import customisation files to replace the current layout of the Ribbon and Quick Access Toolbar. you lose all prior Ribbon and Quick Access Toolbar customisations. Record a macro When you record a macro. You can also create a macro by using the Visual Basic Editor in Microsoft Visual Basic for Applications (VBA) to write your own macro script. or control) so that you can run it by clicking the object. Click Import customization file. or to copy all or part of a macro to a new macro. 2. you can delete it.

do the following: 1. 1. enter a name for the macro. 2. and then click OK. click Record Macro.3. click Macro Security. 2. In the Macro name box. and then click OK. 28 . To set the security level temporarily to enable all macros. Once you have enabled the Developer tab. select the Developer check box. in the Code group. Under Macro Settings. you can then record a new macro. potentially dangerous code can run). click Enable all macros (not recommended. On the Developer tab. 2. in the Main Tabs list. On the Developer tab. In the Customize Ribbon category. in the Code group.

When you select Personal Macro Workbook. 3. 4.The first character of the macro name must be a letter.xlsb) if it does not already exist. To assign a CTRL combination shortcut key to run the macro. If you use a macro name that is also a cell reference. The shortcut key will override any equivalent default Excel shortcut key while the workbook that contains the macro is open. numbers. in the Shortcut key box. Excel creates a hidden personal macro workbook (Personal. or underscore characters. you may get an error message that the macro name is not valid. and saves the macro in this 29 . Subsequent characters can be letters. type any lowercase letter or uppercase letter that you want to use. select the workbook where you want to store the macro. Spaces cannot be used in a macro name. In the Store macro in list. If you want a macro to be available whenever you use Excel. select Personal Macro Workbook. an underscore character works well as a word separator.

Do one of the following: • Open the workbook that contains the macro that you want to delete. click Stop Recording . Delete a macro 1. in the Code group. If the Developer tab is not available. click PERSONAL. • If the macro that you want to delete is stored in the personal macro workbook (Personal. For example. Workbooks in the XLStart folder are opened automatically whenever Excel starts. In Windows Vista and 7. 2. select the workbook that contains the macro that you want to delete. in the Main Tabs list. in the Window group. 2. 7. Click Options. 3.xlsb). click This Workbook. In Microsoft Windows XP. On the View tab. Perform the actions that you want to record. 6. 5. Click the File tab. Under Unhide workbooks. and then click OK. this workbook is saved in the C:\Users\user name\AppData\Local\Microsoft\Excel\XLStart folder. click Unhide. Click OK to start recording. and then click OK. you must also save that workbook in the XLStart folder so that both workbooks are opened when Excel starts. 30 . type a description of the macro. in the Code group. 1. In the Description box. 8. and then click Customize Ribbon. On the Developer tab. In the Customize Ribbon category. and this workbook is hidden.workbook. do the following to unhide the workbook: 1. click Macros. On the Developer tab. 2. do the following to display it: 1. If you want a macro in the personal macro workbook to be run automatically in another workbook. In the Macros in list. 2. select the Developer check box. this workbook is saved in the C:\Documents and Settings\user name\Application Data\Microsoft\Excel\XLStart folder.

Click Delete. Select Yes to remove the macro. 31 . You will be prompted if you wish to delete the selected macro.3. In the Macro name box. or No to keep this. 5. click the name of the macro that you want to delete. 4.

VLOOKUP works in the same principle. VLOOKUP Syntax VLOOKUP is made up of 4 types of syntax: Lookup_value – This is the value that you want to find in the first column. Range_lookup – This value is set to TRUE or FALSE. Table_array – This is the table of data that VLOOKUP searches to find the information. then their phone number. If you set this to FALSE. then when you look up the value in the Lookup_value criteria. You select the entire range of columns and rows you wish to search on. For example. such as their address. If you wanted to retrieve the phone number. If you set TRUE. then when you look up the value.VLOOKUP The VLOOKUP function in Excel stands for vertical lookup. then you can retrieve or reference data that appears in the same row. the address is the 2nd column of data and the phone number is the 3rd column of data. 32 . you can then see more information in different fields/columns. as this is the 3rd column of data. this must be an exact match. you first search for their name. but a different column. In the phone book example above. you’d type in the name of the person here. Once you’ve found their name. if you look at the phone book image towards the top of the page. you could state that the name and initials are the 1st column of data. Col_index_num – This is the number of the column that you wish to find the data in. it would find an approximate match to the Lookup_value. You base your search on the first column of data. Choosing to use TRUE or FALSE will be explained more in detail in the next couple of sections. you would enter 3. When you want to find somebody’s phone number. and is used to find specific information that has been stored in columns or a table. The simplest way to think of how VLOOKUP works is by comparing it to a phone book.

We would then set the Table_array to cover where the entire range of the data you wish to search on is located (which in this case is everything in the cells from A2 to C9). the price of one of these boots. then selecting the first column and sorting in to order). and then the one in the next heading will use a value of TRUE.Example of using VLOOKUP using a FALSE Range_lookup The best way to understand the VLOOKUP function is to reproduce these following examples. with a unique ID and a price. For this first example. under the Editing section. to show you the difference between using both arguments. The important thing to remember when running a VLOOKUP is to make sure that the first column you are searching on contains unique data. below are a short list of pairs of football boots. as this is the third column where the prices are listed. we would create the VLOOKUP and type in the ID of the boot in the Lookup_value field. The first column you are searching on must be sorted in ascending order (you can achieve this by using the Sort & Filter option within the Home ribbon. We will base this search on the ID of 1214. VLOOKUP will not work properly if you have duplicated data in the first column you are searching on and will only show the first result it finds. as we want the exact ID to be found and not an approximate match. which is the CTR360 Maestri III FG football boot. This VLOOKUP would therefore be entered as this: 33 . then the Range_lookup as FALSE. The first will use the Range_lookup value of FALSE. the Col_index_num as 3. If we wanted to retrieve for example.

column A has to be sorted in to order and no duplicates should appear.00. as shown below. which is shown on the next page. you will see the price of £145.=VLOOKUP(1214. is the price. we can see that the value of 1214 is found in cell reference A3. this would appear in the Function Arguments box as the following: When we have typed in the arguments to this function and clicked on OK. From looking at the data. Once Excel has found the value 1214 in column A.A2:C9. Excel will then search the entire data range within the cells A2 to C9. It will look for a value matching 1214 anywhere in column A. 34 . we have asked the function to then retrieve the data that is listed in the third column. so if you then look at the third column in this row.3. This will be the result we are trying to find. As previously mentioned.FALSE) In Excel. which in the example above.

20 or 50 boots.Example of using VLOOKUP using a TRUE Range_lookup The previous example was based on using a FALSE Range_lookup argument. we’ll still use the existing football boot list that we used in the previous example. Using the TRUE Range_lookup though fixes this problem. The TRUE Range_lookup is described within Excel as ‘to find the closest match in the first column (sorted in ascending order)’. then at first. If they purchase 3 boots. but we’ll create a discount based on how many boots have been purchased. This basically means that when searching for the criteria in column A. they get 5% discount. If they purchase 5 boots. In the following example. 10. Excel will look at the Table_array we have set (which is H2 to I6). we’ll create the discount. 35 . if somebody purchases one football boot. then it will try and find the value of 3. that doesn’t appear to be covered in the criteria set above. which is straight forward text entered in to cells: Looking at the discount above. 5. We have to factor in though the likelihood that consumers will not purchase exactly 1. If they purchase 10 boots they will receive a 10% discount and so on. If for example you purchase three boots. Excel has to find an exact match for the data you are searching for. they get no discount. First of all.

you’d receive a 15% discount and as 50 is the largest number we have entered in this column. 20 to 49 boots. but to make things tidier. As we have set this to be TRUE. we’d change the Lookup_value to be 48. search on the same Table_array as before and set the Range_lookup to be TRUE. So if you purchase 1 to 4 boots. if we purchased 48 boots. you would receive 0% discount. To confirm. adding a standard formula to show the original cost. it will check for the Range_lookup value. Although close to 50. Excel is clever enough though to work out in our example that each number we have entered in column H (1. If you purchase 5 to 9 boots. 50 or more boots would receive a 20% discount. 20 and 50) is seen as ‘this number of greater value’. it is less than this figure.As it’s not listed in the column H above. 36 . which is 15%. 1. 5. it will then find the nearest match to the value we entered in the Lookup_value argument. 10 to 19 boots. you’d receive a 5% discount. This doesn’t have to be done. you’d receive a 10% discount. You could add a simple formula as well to then find the price of the boot and work out the discount. then apply the discount will gives us a new total per boot. so the discount that was applied for 20 or more (but less than 50) is given.

two more entries have been created in cells M2 and M3 In cell M2. the cell in F1 has been referenced. which was already working out the boot price through the first VLOOKUP we created. a formula was created to take the cost of the boot in cell M2.Using the football boot sheet. then minus the discount that was in cell M1. In cell M3. to give the final boot price. 37 .