0% found this document useful (0 votes)
34 views20 pages

VLookup and HLookup in Microsoft Excel

VLookup-and-HLookup-in-Microsoft-Excel

Uploaded by

powermy972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views20 pages

VLookup and HLookup in Microsoft Excel

VLookup-and-HLookup-in-Microsoft-Excel

Uploaded by

powermy972
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

VLOOKUP and

HLOOKUP in
Microsoft Excel
VLookup
• Searches for a value in
the first column of a Collingsworth 1
table array and returns a Comanche 1
value in the same row Dallas 16
from another column in
the table array. Denton 6
El Paso 4
Ellis 2
Fannin 1
Fort Bend 1
Galveston 4
HLookup
• Searches for a value in the top row of a table
or an array of values, and then returns a value
in the same column from a row you specify in
the table or array.

El Paso Ellis Fannin Fort Bend Galveston


4 2 1 1 4
Syntax
• VLOOKUP
(lookup_value,
table_array, What you’re looking for
col_index_num,
range_lookup) Where you’re going to look
What you want to know
Is ‘close’ good enough?

HLookup has the same syntax, with


“row_index_num”
instead of “col_index_num”. We’ll talk about
VLookup today.
lookup_value

•The value to search for in the first


column of the table array.
•If lookup_value is smaller than the
smallest value in the first column of
the table array, VLookup returns the
#N/A error value.
table_array
•Data in columns.
•If the table is not sorted in ascending
order on the first column, the function
can give unpredictable results.
•Use ‘absolute’ references. (Put a $
before the letters and numbers in the
references, i.e. $A$2:$B$255)
•Do not include column headers
col_index_num
•The column number in the table
array from which the matching
value must be returned.
•A col_index_num of 1 returns the
value in the first column in the table
array; col_index_num of 2 returns
the value in the second column, and
so on.
range_lookup
•A logical (True/False) value that
specifies whether you want
VLookup to find an approximate
match or an exact match.
•Defaults to “True”.
•You will almost always want it to be
“False”.
What would happen Collingsworth 1
if Comanche 1
VLookup were
looking for Dallas 16
Dallam County in Denton 6
this table and El Paso 4
With range_lookup
returning left
theas “True”, the value
or Comanche County will be returned. Ellis 2
second column?
Fannin 1
With range_lookup set to “False” an error
Fort Bend
message will show that Dallam County was
1
not found. Galveston 4
We can deal with error messages!!
SO WHAT ?!?!?!
Why would we submit ourselves to
such a complicated function?
Combine data tables
Case
Case Populat
Populat
Count
Count ion
ion by
by
by
by County
County
County
County

Inciden
Inciden
ce
ce Rate
Rate
by
by
County
County
Example

wo worksheets:
“Case Count” has a list of case counts by coun
“County Population” has a list of all counties
with their populations.
County
•=VLOOKUP(A2,'Case Count'!
$A$1:$B$58,2,FALSE)
•This formula will return an error for any
county that has no cases.
•What we really want is 0

This is where it gets complicated…


Handling Errors

•This is where I lose people…


•If the original formula gives an error, we
want a zero. Otherwise we want the
result of the original formula.
•The Excel function IfError() will let us
choose between the value of a function
(vlookup) or another value if the
function returns an error.
•=IfError([original formula], 0)
•=IFERROR(VLOOKUP(A2,'Case Count'!
$A$1:$B$58,2,FALSE),0)
Where might we use True
for the range_lookup
parameter?

To group numeric values into


ranges.
What would happen if
VLookup were looking for 00 - 4
55 - 9
24 in this table and returning the
1010 - 17
second column? 1818 - 24
2525 - 34
With range_lookup set to “False” an error
3535 - 44
message will show that 24 was not found.
4545 - 54
5555 - 64
We don’t want an error message, or a6565+
default
value. We want an ANSWER!
What would happen if
VLookup were 0 0-4
5 5-9
looking for
10 10 - 17
24 in this table and 18 18 - 24
returning
With the second
range_lookup set to 25 25 - 34
column?
“True”, Vlookup will start at 35 35 - 44
the top of the table, work its 45 45 - 54
way down to the last value in
column 1 that is earlier in the
55 55 - 64
sort than the lookup_value. 65 65+
The table MUST be sorted
by the first column!! You
will get wrong answers, and
it may not be obvious that
they are wrong.
In this version of Vlookup,
there are no error messages
for missing values.
Investigation ID2 Age Reported Birth Time Event Date Age Age Group
CAS482442134TX01 49 7/8/1966 11/21/2015 49 45 - 54
CAS482247044TX01 53 7/18/1961 2/14/2015 53 45 - 54
CAS482247047TX01 59 7/22/1955 3/5/2015 59 55 - 64
CAS482247055TX01 8 6/18/2014 3/3/2015 0 0-4
CAS482247057TX01 47 5/19/1967 3/5/2015 47 45 - 54
CAS482247060TX01 1 8/14/2013 3/3/2015 1 0-4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy