Sei sulla pagina 1di 3

Excel Function Dictionary VLOOKUP

© 1998 - 2000 Peter Noneley Page 1 of 3

A B C D E F G H I J
1 VLOOKUP
2
3 The column numbers are not needed.
4 they are part of the illustration.
5 col 1 col 2 col 3 col 4 col 5 col 6
6 Jan 10 20 30 40 50
7 Feb 80 90 100 110 120
8 Mar 97 69 45 51 77
9
10
11 Type a month to look for : Feb
12 Which column needs to be picked out : 4
13
14 The result is : 100
15 =VLOOKUP(G11,C6:H8,G12,FALSE)
16
17 What Does It Do ?
18 This function scans down the row headings at the side of a table to find a specified item.
19 When the item is found, it then scans across to pick a cell entry.
20
21 Syntax
22 =VLOOKUP(ItemToFind,RangeToLookIn,ColumnToPickFrom,SortedOrUnsorted)
23 The ItemToFind is a single item specified by the user.
24 The RangeToLookIn is the range of data with the row headings at the left hand side.
25 The ColumnToPickFrom is how far across the table the function should look to pick from.
26 The Sorted/Unsorted is whether the column headings are sorted. TRUE for yes, FALSE for no.
27
28 Formatting
29 No special formatting is needed.
30
31 Example 1
32 This table is used to find a value based on a specified name and month.
33 The =VLOOKUP() is used to scan down to find the name.
34 The problem arises when we need to scan across to find the month column.
35 To solve the problem the =MATCH() function is used.
36
37 The =MATCH() looks through the list of names to find the month we require. It then calculates
38 the position of the month in the list. Unfortunately, because the list of months is not as wide
39 as the lookup range, the =MATCH() number is 1 less than we require, so and extra 1 is
40 added to compensate.
41
42 The =VLOOKUP() now uses this =MATCH() number to look across the columns and
43 picks out the correct cell entry.
44
45 The =VLOOKUP() uses FALSE at the end of the function to indicate to Excel that the
46 row headings are not sorted.
47
48
49 Jan Feb Mar
50 Bob 10 80 97
Excel Function Dictionary VLOOKUP
© 1998 - 2000 Peter Noneley Page 2 of 3

A B C D E F G H I J
51 Eric 20 90 69
52 Alan 30 100 45
53 Carol 40 110 51
54 David 50 120 77
55
56 Type a name to look for : eric
57 Type a month to look for : mar
58
59 The result is : 69
60 =VLOOKUP(F56,C50:F54,MATCH(F57,D49:F49,0)+1,FALSE)
61
62 Example 2
63 This example shows how the =VLOOKUP() is used to pick the cost of a spare part for
64 different makes of cars.
65 The =VLOOKUP() scans down row headings in column F for the spare part entered in column C.
66 When the make is found, the =VLOOKUP() then scans across to find the price, using the
67 result of the =MATCH() function to find the position of the make of car.
68
69 The functions use the absolute ranges indicated by the dollar symbol . This ensures that
70 when the formula is copied to more cells, the ranges for =VLOOKUP() and =MATCH() do
71 not change.
72
73 Maker Spare Cost Lookup Table
74 Vauxhall Ignition £50 Vauxhall Ford VW
75 VW GearBox £600 GearBox 500 450 600
76 Ford Engine £1,200 Engine 1000 1200 800
77 VW Steering £275 Steering 250 350 275
78 Ford Ignition £70 Ignition 50 70 45
79 Ford CYHead £290 CYHead 300 290 310
80 Vauxhall GearBox £500
81 Ford Engine £1,200
82 =VLOOKUP(C81,F75:I79,MATCH(B81,G74:I74,0)+1,FALSE)
83
84
85 Example 3
86 In the following example a builders merchant is offering discount on large orders.
87 The Unit Cost Table holds the cost of 1 unit of Brick, Wood and Glass.
88 The Discount Table holds the various discounts for different quantities of each product.
89 The Orders Table is used to enter the orders and calculate the Total.
90
91 All the calculations take place in the Orders Table.
92 The name of the Item is typed in column C of the Orders Table.
93
94 The Unit Cost of the item is then looked up in the Unit Cost Table.
95 The FALSE option has been used at the end of the function to indicate that the product
96 names down the side of the Unit Cost Table are not sorted.
97 Using the FALSE option forces the function to search for an exact match. If a match is
98 not found, the function will produce an error.
99 =VLOOKUP(C126,C114:D116,2,FALSE)
100
101 The discount is then looked up in the Discount Table
Excel Function Dictionary VLOOKUP
© 1998 - 2000 Peter Noneley Page 3 of 3

A B C D E F G H I J
102 If the Quantity Ordered matches a value at the side of the Discount Table the =VLOOKUP will
103 look across to find the correct discount.
104 The TRUE option has been used at the end of the function to indicate that the values
105 down the side of the Discount Table are sorted.
106 Using TRUE will allow the function to make an approximate match. If the Quantity Ordered does
107 not match a value at the side of the Discount Table, the next lowest value is used.
108 Trying to match an order of 125 will drop down to 100, and the discount from
109 the 100 row is used.
110 =VLOOKUP(D126,F114:I116,MATCH(C126,G113:I113,0)+1,TRUE)
111
112 Discount Table
113 Unit Cost Table Brick Wood Glass
114 Brick £2 1 0% 0% 0%
115 Wood £1 100 6% 3% 12%
116 Glass £3 300 8% 5% 15%
117
118
119 Orders Table
120 Item Units Unit Cost Discount Total
121 Brick 100 £2 6% £188
122 Wood 200 £1 3% £194
123 Glass 150 £3 12% £396
124 Brick 225 £2 6% £423
125 Wood 50 £1 0% £50
126 Glass 500 £3 15% £1,275

127
128 Formula for :
129 Unit Cost =VLOOKUP(C126,C114:D116,2,FALSE)
130 Discount =VLOOKUP(D126,F114:I116,MATCH(C126,G113:I113,0)+1,TRUE)
131 Total =(D126*E126)-(D126*E126*F126)

Potrebbero piacerti anche