Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
29 views

How To Extract Data From A Spreadsheet Using VLOOKUP

The document provides instructions on how to use the VLOOKUP, MATCH, and INDEX functions in Excel and Google Sheets to extract data from a spreadsheet. It explains that these functions look up values or positions of values in a table by using a unique identifier. The VLOOKUP function looks up values vertically down columns, while MATCH and INDEX are concerned with data positioning. The document then walks through an example of using the VLOOKUP function to extract sales amounts from an order number table. It explains the syntax and arguments of the VLOOKUP function and how to name the table range for easier use in formulas.

Uploaded by

Trixie Cabotage
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

How To Extract Data From A Spreadsheet Using VLOOKUP

The document provides instructions on how to use the VLOOKUP, MATCH, and INDEX functions in Excel and Google Sheets to extract data from a spreadsheet. It explains that these functions look up values or positions of values in a table by using a unique identifier. The VLOOKUP function looks up values vertically down columns, while MATCH and INDEX are concerned with data positioning. The document then walks through an example of using the VLOOKUP function to extract sales amounts from an order number table. It explains the syntax and arguments of the VLOOKUP function and how to name the table range for easier use in formulas.

Uploaded by

Trixie Cabotage
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

5.

1 How to Extract Data from a Spreadsheet using VLOOKUP, MATCH and INDEX

When you have a lot of data on a worksheet and you want to extract some of that data to use on
other worksheets, the VLOOKUP match and index functions are great ways to do it.

These functions work in any version of Excel on Windows or Mac. And they also work on the web
in Google Sheets, and also on the web versions of excel.

With the VLOOKUP function and the V stands for vertical, you have data arranged down
columns.

And by the way, there is also an HLOOKUP function where you have data arranged across rows
H is horizontal and it works the exact same way as you look up. So, there's really no need for me to
cover that.

In this tutorial. You can grab actual data from a worksheet like you see here and use it another
sheets. Whereas the match and index functions - are really concerned with the positioning of data
where your data are located rather than what is the actual value of the data.

If you want to follow along in this tutorial, using your own workbook, go right ahead. If you'd like to
use the sheet that I have here on screen. You can see it's called VLOOKUP example, you can
download this from the touch plus website right here on the page where you're watching this tutorial.
And before we actually start clicking around and writing formulas. I want to give give you a little bit
of info on how VLOOKUP works.

VLOOKUP - links to different tables and they could be on the same worksheet or more likely on
different worksheets, even in different workbooks, using a unique identifier.

And the unique identifier that we're going to use in this tutorial is going to be an order number, but
in other situations, it could be other things.

You can think of it, sort of like as a serial number, if you work with databases, you might be
familiar with the concept of a primary key. So, with this table in mind.

Let me explain how the syntax works like any function.

We start off with an equal sign (=) and then you have the name of the function, VLOOKUP
and open parenthesis.

 =VLOOKUP(

There are three (3) required arguments in one optional argument.

 The first argument is what's called the lookup value and that's that unique identifier that
we were talking about.
 =VLOOKUP(lookup value

o And in are example, that's going to be the order # (number) now because you have
to have commas separating the arguments in any function after you. It in the lookup
value, type in a comma.
 The second argument, is the table range.
 =VLOOKUP(lookup value, table range

o An example, that's going to be the entire table. But keep in mind. It doesn't always
have to be that. Then we put in a comma.

 The third argument is the column number.


 =VLOOKUP(lookup value, table range, column #

o Now, let's say we want to get the sale amount and you can see here. That's the last
column in this table. In this instance. That's column number (8) eight. Now, don't
get that confused with the fact that you can see here. It's column h. There's no law
that says that the table has to start in column. A.

So, let's say, for example, if we start the table in column B, then the sale column is still going to be the
eighth column, but it's going to be in column I instead of column H. So that's why we're referring to
the actual column number of the data table. Not the column of the worksheet.

 Anyway, after you put in the column number, you put in a comma and then that optional
argument at the end is true or false.
 =VLOOKUP(lookup value, table range, column #, true/false)

And this could be a little confusing. In this instance, we're going to say false. And what that means is
this.

False - means don't give me an approximation, it gives me an exact amount.

True - means an approximation is, okay.

Now, there are times when an approximation is, alright, but when we're looking at order numbers and
what we want to plug in an order number and find the sale amount of that order number, we really
don't want an approximation and then, of course, we close the function with a matching parenthesis.

One other thing because we're Going to put this entire table in a formula. We need to make sure that
they're referring to the table with an absolute reference because we're going to put in the
VLOOKUP function. And then we want to autofill down that is we want to copy and paste down the
formula, all the way down, a couple hundred rows, understanding absolute references is beyond the
scope of this tutorial, but suffice to say it could be a little messy when you're using an absolute
reference in a long form.

So, what I find it's easier to do is to create a range name. When you give a name to arrange, like to
this whole table that we have, and you could use that name in your formulas first.

I'll show you how to create a range name in Excel and works the same way and Windows or Mac and
then I'll show you how to create a range name in Google Sheets.

Now, the range itself. You have a choice, you can have it include the column headers, or you could
have it be just the data below the column headers, and the grid. Conversion of this tutorial, I included
the column headers.
So just to be a little different this time. I'm going to include only the data and not the actual column
headers.

So, what I'm going to do is I'm going to click over here on Cell A5 - so that's the first cell of actual
data. And I'm going to select down and across to the last cell here. So, in Windows, I'll press control
shift end. (CTRL + Shift)

If you're using a Mac, you want to press command shift in.

And you see that selects all the way down and across to the last self. Now to apply the name, I click
up here in the name box, now not on the drop-down button on the actual box here. And when you do
that, you see that cell reference gets highlighted and I'm just going to call it data. You could call it
almost anything you want. You can't have spaces or dashes in the name though, and you're limited to
33 characters.

So, I'll just call this data and press the ENTER key. And there it is. You can see that data is up there
in the name box, and we know that. It works because I can put somewhere over here. And then when
I click this down arrow and choose data, you can see it's selected. And again, I did not include the
column headers.  

Reading range names is a little different in Google Sheets. So here I have the same exact worksheet
and you can see I'm in my browser.

So, I'll click on the same first, bit of data. We can't select from a cell down and across in Google
Sheets. You have to select first across and then down or first down and then across.

So, I'll press control shift, right-arrow or if you're on the Mac, command shift, right arrow. And now,
I'll press control shift. Down arrow on the Mac, command shift down arrow.

Now that I've done that, I go up to the Data menu and over here. I choose Named and protected
ranges. And then in this box over here, I'll call it data and then click done and you can see it's over
there and then I'm done with that. I can close this little panel with that X.

So, in this tutorial, this is the only thing that's different between Google Sheets and Excel.

Okay, so let's enter some Formulas already enough talking.

Right now, I'm on the source data sheet. Let's click on the sale amounts sheet. And you can see I
already have the order numbers.

And what we want to do is use the order number to look up the sales amount like I was talking
about.

So, let's start entering, the formula is a equals VLOOKUP (=vlookup), and if you get that little syntax
are, you don't have to type the whole thing? Just press the Tab Key and it gives us a little bit of syntax
help in the lookup value. =VLOOKUP

We know, is that order number. So, I click that and I type a comma. Now, the Table array, that's the
table we had. =VLOOKUP(A5,
So, we don't have to go back to the source data sheet and select all that and make it an absolute
reference because we already called a data. So, all I have to do is type the word data.
=VLOOKUP(A5,data

Now if you did not create the range name, you will have to go to the source data sheet and select
the whole thing and make it an absolute reference.

Also, Excel understands that oh, yes. I did create that range name. So, it's in here.

I'll show you also a little trick. Let me just backspace over that.

Let's say I have a lot of range names or created that range name a long time ago. I don't remember
what it is.

I could always press the F3, key on the keyboard and get the Paste Name box and just double click it
and I'll type of comma and then it asks me for the column index number we said before that's column
eight that's where the sales figure is put in a comma and here's even giving us a little syntax up.

We want true or do we want false? Who want an exact match. So you can type the word, false, or you
could double click it. And it puts it in close parentheses and right and it's 40.

And in fact if we go back here, so we're seeing who can see how yes indeed. That's correct.

Let's go back here. And we want to autofill this, so click the cell. And if you're not all that familiar
with auto-filling you notice that there's a little dot in the lower right corner of the cell and you put the
mouse pointer over the dot and mouse pointer becomes this little Crosshair.  

And even if you know autofill, here's something that most people don't know. You don't have to
click and drag this down for 200. Whatever rest.

All you have to do is double-click the Crosshair   and it fills in all the way down.

So, you can scroll all the way down. And you can see it's filled in all the way. That's because there are
no gaps in column. A, if there is a gap somewhere in column A then at autofill, just kind of stopped
where that Gap is.

If you want to practice this on your own you could go here and maybe to column C or column D and
go and use VLOOKUP to find, maybe people's last names or the states.

So, let's take a look at the Match function. We can click the match tab here in the worksheet. As I
said earlier.

The Match function - isn't really concerned with the value of data BUT location of data actually
kind of like the game of Jeopardy.

You tell it what the value is and the match function tells you where the value is.

Kind of if you think of maybe you're walking down the street and you say to somebody who we were
as number 135, and they tell you. Oh, number 135 is the fourth building down.
MATCH function

So, let's talk a little bit about the syntax of the match function.

We say equals match open the parentheses, right? Just like any function and then you put in the
lookup value. That's just like what we were talking about before that's going to be the order number in
a comma and you have the table range. Table range is the same as what we were talking about before.
And our case. We're going to use the entire table, put in a comma, and then you enter the TYPE.

=MATCH(lookup value, table range, type)

Now, what's that type all about?

Type - when you have that value, you're looking for, you may have value that's just above it or just
below it.

Syntax

=MATCH(lookup value, table range, type)

Type

Closest Above

Target Value

Closest Below

And to determine whether or not either of those are acceptable, that type.

Type

Closest Above -1 Values must be in descending order

Target Value 0 Values can be in any order

Closest Below 1 Default. Values must be in ascending order.

You can put in negative 1 (-1) 0 or a 1.

 Negative one (-1) - means you'll choose the number. That's the closest above it.

 Positive one (1) - it's the closest number below it.

 Zero (0) - it means you want an exact match.


Also with the match function, you have to be aware of, whether your data are sorted, in any particular
order, so:

 You have to have data sorted in descending order to use the negative one (-1) option.

 You have to have your data sorted in descending order. If you're going to use the positive
one (1) option and you can see, that's the default.

 If you don't care, if that's in one order another then you can use a zero (0).

And since we're looking for only one piece of data. We're looking for that order number. We need to
go in to find another range name.

So, let's go back to Source data and we're going to be concerned just with the order number.

So, we already have a range name - that's for the entire table.

Now, we just want a range name for the data going down, column A. So, kind of like we did before.

You want to click on Cell A5, press control shift, down arrow, or command shift down arrow on the
Mac.

Let's go up here. Click inside the name box. And I'm going to call this   order underscore number
(order_number).

Underscores, our okay, Dashes are not spaces are not OK and press enter.

If you're doing this in Google Sheets, use the same procedure that I showed you just before.

So, let's go back to the match worksheet and we'll put in the function.

Let's say equals match open the parentheses. Lookup Value. We said that's the order number comma.
Look up array, right? That's what we just put in the order number.

=match(lookup value,lookup array =match(A5,order_number,

If you want, you can press the F3, key. And you can see there's the TWO range names. Double click
(order_number) type in a comma (, ) and we have our values and ascending order.

So, I'm going to choose the one. Click it, this parenthesis and enter it.

=match(A5,order_number,1)

And now we can see that order 1013 is in the 13th position.

Now, if you have it included, the column headers and this would be showing 14.

And we could eyeball, is let's go back here and we can see there is order 1013 if we count from the
top.   That is the 13th, one down.

Finally. Let's talk about the Index function.


And I'm going to click on the index tab of this worksheet.

The Index function - is kind of like the opposite of the match function and it deals with two
Dimensions.

Two (2) Dimensions:

1. Rows
2. Columns

So, we tell it, here's the road number and the column number. I'm looking for which means a
particular cell now return to me the value that's in that particular cell.

INDEX function

So, let's take a brief. Look at the syntax of Index function.

We say equals index open. The parentheses. First argument is the table range or data range. And
it's the entire table that we've been looking at, comma (,) and then you have the row number put in a
comma and then optionally the column number.

=INDEX(table range, row number, [column number])

Now, this is a little weird because the official documentation tells us that column number is optional,
BUT it's really the row number can also be optional and what that means is when you have a large
table, like, what we're working with, you do want a row, number, and column number.

But let's say YOU only have single row. Well, then you don't need to column number or if you only

have single column then you don't need a row number.

So let's put in the function, little going to be here on Cell C6. So I'm going to say equals index open at
the parentheses and just like before the range is the entire data range. You can see finds it for us, then.
Going to come up and we want row 9 comma, column 3, close, the parenthesis enter it.

=index(data,row 9, column 3) =index(data,A6,B6)

And now we can see that. That is somebody's last name.

Let's take a look. Go back to Source data and we can see there. It's the ninth row down and third
column over we go back here.

And let's say just for example, maybe I want to go to row 13 and see it's already changing column 4
then I have the state.

So, if I go back over here, you can see. All right, there it is. This is row 13 column 4.

So having these three functions that can look at a large worksheet and extract value, and positioning
of data are really great tools.

This way you can have one sheet that has all of the data and the universe and then individual sheets
where you're picking up, just those pieces of data that you need.

And All of the parts of excel that people ask me about VLOOKUP is Far and Away the most
comment.

You might also like