Вы находитесь на странице: 1из 16

Lookup Function in Excel 2013

1 What is Lookup Function


Lookup functions enable you to look up values from worksheet ranges.
The Microsoft Excel LOOKUP function returns a value from a range (one row or one column) or from an ar
Four Lookup Functions
LOOKUP
The Microsoft Excel LOOKUP function returns a value from a range (one row or one column) or from an
array. There are 2 different syntaxes for the LOOKUP function:
Syntax #1
In Syntax #1, the LOOKUP function searches for value in the lookup_range and returns the value in the
result_range that is in the same position.
LOOKUP( value, lookup_range, [result_range] )
value

The value to search for in the lookup_range.

lookup_range

A single row or single column of data that is sorted in ascending order. The
LOOKUP function searches for value in this range.

result_range

Optional. It is a single row or single column of data that is the same size as
the lookup_range. The LOOKUP function searches for the value in
the lookup_range and returns the value from the same position in
the result_range. If this parameter is omitted, it will return the first column
of data.

NOTE

If the LOOKUP function can not find an exact match, it chooses the largest value in the lookup_ran
than or equal to the value.

If the value is smaller than all of the values in the lookup_range, then the LOOKUP function will retu

If the values in the LOOKUP_range are not sorted in ascending order, the LOOKUP function will ret
incorrect value.

Syntax #2
In Syntax #2, the LOOKUP function searches for the value in the first row or column of the array and
returns the corresponding value in the last row or column of the array
LOOKUP( value, array )

Parameters or Arguments
value The value to search for in the array. The values must be in ascending order.
array An array of values that contains both the values to search for and return.

VLOOKUP Function

Excel VLOOKUP is a useful function to compare data in two spreadsheets when the lookup values are containe
column of a lookup table. It can be used to import data from one spreadsheet to another for comparison purpose
Syntax
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
Lookup_Value

lookup_value: the value you want to search, or look up, in the first column of a table or range. R

table_array

table_array: the range of cells where you want to look up the comparison data. The values in the firs
the lookup_value. These can be text, numbers or logical values and are not case sensitive. Required
col_index_num

range_lookup

col_index_num: The number of the column in the table_array from which the matching value must
For example, a col_index_num argument of 1 returns the value in the first column in table_array, a c
second column in table_array, etc.

range_lookup: A logical value specifying whether you want VLOOKUP to find an exact match or an
an approximate match, so if an exact match is not found, the next highest value in a range will be re
cases. Optional argument.

HLOOKUP Functions

Use HLOOKUP, or horizontal lookup, when the lookup values are contained in the first row of a table, and the
different row that you specify.
HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

lookup_value: the value to search in the first row of a table or range. Required argument.
table_array: the range of cells where you want to look up the comparison data. The values in the first
lookup_value. These can be text, numbers, or logical values and are not case sensitive. Required argu

row_index_num: The row number in the table_array from which the matching value must be returned
returns the value in the first row in table_array, a row_index_num argument of 2 returns the value in t
argument.
range_lookup: A logical value specifying whether you want HLOOKUP to find an exact match or an
for an approximate match. Recommend that FALSE (0) be used in most cases. Optional argument.

Helpful Hints
When searching text values, make sure the data in the first row of table_array does not contain any trailing or le
quotation marks, or nonprinting characters. Otherwise, VLOOKUP/HLOOKUP could return an incorrect or un

When searching number or date values, make sure data in the first row of table_array is not stored as text value
an incorrect or unexpected value.
If the lookup_value is not found in the first row of the table_array, then the #N/A error value is returned.

Advantages
Simple to Use, Once you understand how it works
Can find an exact or approximate match

one column) or from an array.

Disadvantages/Limitations
It is a volatile function, and can slow down the calculations in a large workbook
The value that you're searching for must be in the leftmost column of the range.

column) or from an

Orgument

ns the value in the


No
One
More than one orgument
optional orguments

cending order. The

is the same size as


he value in
osition in
rn the first column

est value in the lookup_range that is less

e LOOKUP function will return #N/A.

he LOOKUP function will return the

of the array and

Today()
Max()
date()
LOOKUP( value, lookup_range, [r

lookup values are contained in the first


er for comparison purposes.

olumn of a table or range. Required argument.

n data. The values in the first column of the table_array are the values searched by
not case sensitive. Required Argument

ch the matching value must be returned. Required Argument


rst column in table_array, a col_index_num argument of 2 returns the value in the

to find an exact match or an approximate match. If omitted, defaults to TRUE (1) for
st value in a range will be returned. Recommend that FALSE (0) be used in most

rst row of a table, and the values to be returned are in the same column but in a

ed argument.
ta. The values in the first row of the table_array are the values searched by
e sensitive. Required argument

ng value must be returned. For a example, a row_index_num argument of 1


of 2 returns the value in the second row in table_array, etc. Required

find an exact match or an approximate match. If omitted, defaults to TRUE (1)


es. Optional argument.

ot contain any trailing or leading spaces, inconsistent use of straight and curly
d return an incorrect or unexpected value

is not stored as text values. Otherwise, VLOOKUP/HLOOKUP could return

rror value is returned.

ons in a large workbook


ost column of the range.

value, lookup_range, [result_range] )

Order ID Product
10247 Apples
10249 Oranges
10250 Bananas
10251 Pears
10252 Grapes

Unit Price Quantity


$
$
$
$
$

14.00
9.80
34.80
18.60
42.30

12
10
5
9
40

Lookup Syntax 1 Practice


LOOKUP( value, lookup_range, [result_range] )
Lookup for Pears
10251 Pears

=LOOKUP(F5,A2:A6,B2:B6)

Syntax #2

LOOKUP( value, array )


10251 Pears

=LOOKUP(F9,A2:B6)
18.6

18.6 A

Question: In Microsoft Excel, I have a table of data in cells A2:D5. I've tried to create a simple LOOKUP to find CB2 in the da
always returns 0. What am I doing wrong?
Example
Reference Manu
CB 2
CB10
CB19
CB20

Model

Value
3A
Test1
Test2
Test3

Lookup Value
CB2
(Result is Zero)
Fillup the Values Test 1, Test 2, Test 3
=LOOKUP(E15,A16:A19,D16:D19)
(Result is Different)
Reason is the First Column is not in ascending Order
To Avoid these problems VLOOKUP is Used
Test2

Loookup Always see as as

lt_range] )

OOKUP to find CB2 in the data, but it

ways see as assending order

Order ID Product
10252 Grapes
10251 Pears
10250 Bananas
10249 Oranges
10247 Apples
10389 Jackfruit
10222 Muskmelon
10468 Watermelon
10253 Berries
10654 Pomegranate

Unit Price Quantity


42.30
40
18.60
9
34.80
5

9.80
10
24.00
12

3.00
33
54.00
54
46.00
23
13.00
11
15.00
23

Lookup Value

10251

Practice #1
Lookup the Product Names for the value
Lookup the Product for the Value
Lookup Price for the Value
Practice #2
Using VLOOKUP
Lookup the Product Names for the value
Lookup the Unit Pricefor the Value
Lookup Quantity for the Value
Practice #3
Change the Lookup Value and try the following
If you specify FALSE for the range_lookup and no exact
#N/A. (Change the number 10251)
10456

If index_number is less than 1, the VLOOKUP function


10251

If index_number is greater than the number of columns


10251
Practice #4
Region
Jan
North
South
East
West

Feb
5,535
5,013
6,597
3,195

Mar
5,414
5,107
3,858
3,654

9,027
11,667
1,507
7,225

Find Jan Value for Region East


East
Find Mar Value for Region West
West
Find Feb Value for Region South
South
Find Mar Value for Region North
North

VLOOKUP Practice
VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])
12
Apples
24
Sort the Data to get correct values

Pears
18.6
9

y the following
nge_lookup and no exact match is found, then the VLOOKUP function will return
0251)

1, the VLOOKUP function will return #VALUE!.

an the number of columns in table, the VLOOKUP function will return #REF!.

Order ID
10252
10251
10250
10249
10247
10389
10222
10468
Product Grapes
Pears
Bananas Oranges Apples
Jackfruit
Muskmelon Watermelo
Unit Price 42.30 18.60 34.80 9.80 24.00
3.00
54.00 46.00
Quantity
40
9
5
10
12
33
54
23

HLOOKUP Practice
HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])
HLOOKUP Value

Practice #5

10249

Find the Product Name

10468

Find the Unit Price

10253

Find the Quantity

Practice #6
Change the Lookup Value and try the following
If you specify FALSE for the range_lookup and no exact match is found, then the VLOOKUP function will return
#N/A. (Change the number 10251)
10456
If index_number is less than 1, the VLOOKUP function will return #VALUE!.
10251

If index_number is greater than the number of columns in table, the VLOOKUP function will return #REF!.
10251

10253
10654
Berries
Pomegranate
13.00
15.00
11
23

UP function will return

will return #REF!.

A
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

Practice #7

104
HP
Printer

101
Dell
Computer

102
Logitech
Keyboard

How can I write a formula to compute tax rates based on income?

Tax Rate on Income


Income Tax rate
0
10000
30000
100000

Give Range Name: Lookup1 for the table


Range Name

0.15
0.3
0.34
0.4

Explain on Usage of Range Names VS Absolute Values

Compute Tax Rate

Income Rate
-1000
30000
29000
98000
104000

#N/A
0.34
0.3
0.34
0.4

#N/A
0.34
#N/A
#N/A
#N/A

Practice #8

Given a product ID, how can I look up the products price?


Give Range Name as Lookup2

Product ID
A134
B242
X212
C413
B2211
Practice #9

Price
$
$
$
$
$

3.50
4.20
4.80
5.00
5.20

ID
B2211
B2211

Price
5.2
5.2

3.5
3.5

Suppose that a products price changes over time. I know the date the product was sold. How
can I write a formula to compute the products price?

Date
Price

1/1/2005
98

5/1/2005
105

8/1/2005
112
Range Name
Lookup3 :D42:F43

Date

Price
1/4/2005
5/10/2005
9/12/2005
5/1/2005

Practice #10
ID

98
105
112
105

Find the Brand and Product Name for the Product ID mentioned in the table

Brand
101 Dell
102 Logitech
103 Logitech
104 HP

Product
Computer
Keyboard
Mouse
Printer

ID

Brand
104 HP
103 Logitech
104 HP
101 Dell
102 Logitech
103 Logitech
101 Dell
104 HP
101 Dell
102 Logitech

Product
Printer
Mouse
Printer
Computer
Keyboard
Mouse
Computer
Printer
Computer
Keyboard

Practice #11
ID
Brand

101
Dell

102
Logitech

103
Logitech

104
HP

Product

Computer

Keyboard

Mouse

Printer

ID
Brand
Product

104
HP
Printer

103
Logitech
Mouse

104
HP
Printer

101
Dell
Computer

102
Logitech
Keyboard

103
Logitech
Mouse

101
Dell
Computer

Вам также может понравиться