excel vlookup
Microsoft Office Training verified by visa - mastercard securecode about microsoft training company london ukadd this page to your favourites/bookmarksAdd to favourites
view a printable version of this pagePrintable version
email this page to somebodyEmail this page
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Excel vlookup

Excel vlookup

The UK's most regular instructor-led training courses.
Training information: excel training · Excel training london · Microsoft Excel Training UK
See also · excel-courses-london · excel courses in london · excel microsoft training

resolvedResolved · High Priority · Version 2003

Excel vlookup

Kingsley.k. has attended:
Excel Advanced course

by - delegate Kingsley.k. [4 posts] (2008 Jul 3 Thu, 14:02) replyReply

I'd like to link selected contents of a table from one spreadsheet to another, but I would like the function to copy only the rows in which the value in first column equals 'X' .

Excel VBA 2 day course
Version Date Location Places
available
Book Next place rate:
Card Invoice
2007 2008 Nov 25 Tue + 26 Wed Bayswater 6 book now £455 £515
2003 2008 Nov 26 Wed + 27 Thu Bloomsbury 2 book now £495 £495
2003 2008 Dec 1 Mon + 2 Tue Bloomsbury 2 book now £495 £495
2003 2008 Dec 4 Thu + 5 Fri Bloomsbury 5 book now £450 £485
2007 2008 Dec 11 Thu + 12 Fri Bayswater 5 book now £475 £515
2007 2009 Jan 8 Thu + 9 Fri Bloomsbury 6 book now £450 £475
Full Schedule: See all 37 Excel VBA course dates.
Bookings currently available until 26th November 2009.

RE: Excel vlookup

by - trainer Pete platinum contributer[799 posts] (2008 Jul 7 Mon, 08:18) Edited on 2008 Jul 7 Mon, 10:38 replyReply

Hi Kingsley, Thank you for your post, after a bit of consideration I think that the following rambling explanation might be of help:

Question: I'd like to link selected contents of a table from one spreadsheet to another, but I would like the function to copy only the rows in which the value in first column equals 'X' .

If you've been using Excel for a while, you have invariably found someone who talks about using INDEX() and MATCH() instead of VLOOKUP. Give me a couple of minutes and I will try to explain them in simple English.

A 30 second review of VLOOKUP;

Say you have a table of employee records. The first column is an employee number, and the remaining columns are various pieces of data about the employee. Any time you have an employee number in the worksheet, you can use VLOOKUP to return a specific datum about the employee. The syntax is VLOOKUP(value,data range,col no.,FALSE). It says to Excel, "Go to the data range. Find a row that has (value) in the first column of the data range. Return the (col no.) the value from that row.

When the key field is to the right of the data you want to retrieve, VLOOKUP will not work.

One common solution is to temporarily insert a new column A, copy the column of names to the new column A, populate with VLOOKUP, Paste Special Values, then delete the temporary column A.

I am going to suggest you take a challenge to use a different method;

So, let me break it down into two pieces.

First, there is the INDEX() function. This is a horribly named function. When someone says "index", it does not conjure up anything in my mind that is similar to what this function does. Index requires three arguments. =INDEX(data range, row number, column number). In English; Excel goes to the data range and returns you the value in the intersection of the (row number) the row and the (column number) the column. Hey, that’s pretty straightforward, right? =INDEX($A$2:$C$6,4,2) will give you the value in B5.

Applying INDEX() to our problem, you can figure, that to return the employee number from the range, you would use this: =INDEX($A$2:$A$6,?,1). Actually, this piece of it seems so trivial that it seems useless. But, when you replace the question mark with a MATCH() function, you have the solution.
Here is the syntax: =MATCH(Value, Single-column data range, FALSE). It tells Excel, "Search the data range and tell me the relative row number where you find a match for (data).

So, to find which row has the employee in A10, you would use =MATCH(A10,$B$2:$B$6,FALSE). Yes, this is more complex than Index, but it should be quite easy for a VLOOKUP pro. If A10 contains "Smith, John" then this MATCH will return that he is in the 3rd row of the range B2:B6.

There it is - the MATCH() function tells the Index function which row to look in - you are done. Take the Index function, replace your question mark (x) with the MATCH function, and you can now do the equivalent of VLOOKUPs when the key field is not in the left column. Here is the function to use:
=INDEX($A$2:$A$6,MATCH(A10,$B$2:$B$6,FALSE),1)

Write it out: First the explanation for MATCH(). Below that the explanation for INDEX(). Then draw a funnel shape between the two to indicate that the MATCH() function drops in to the 2nd argument of the INDEX() function. The first few times I had to do one of these, I was tempted just to slam a new temporary column A in there, but went through the pain of doing it this way instead. It is faster, and requires less manipulation. So, the next time you are wishing you could put a negative number in the VLOOKUP function, try this strange combination of INDEX and MATCH to solve your problems.

Now that you have met INDEX and MATCH could also nest the MATCH function in a VLOOKUP;

The VLookup formula returns data from any column you choose in the data table, simply change the number of the column in the third argument.

The final result is a nested formula such as this:
=VLOOKUP (A2, Data, MATCH(A1, Row 1, 0))

I hope that has helped. if so please click the resolved link, regards Pete


Related articles

· Reasons Why VBA for Excel Training Fails
· Excel and Inventory Management
· Microsoft Excel Training: Not Just for Newbies Anymore
· Why Should I Learn Visual Basic in Excel?
· How Small Businesses Profit from Outside Excel Training

Please browse our web site to find out more about
excel training and other Microsoft training courses.

Excel tip:

Random Numbers

Type =RAND()*200 to generate a number between 1 and 200.
Use the fill handle to drag down and populate as many cells as you'd like with random numbers.

View all Excel hints and tips

Rate this page:
3.5/5 (2 votes cast)
Institute of IT Training - Accredited Training Provider Microsoft Certified Partner
microsoft office
Microsoft Office Specialist Authorised Testing Centre (MOS and MCAS)

Prodigy Platinum Learning Partner

Institute of IT Training - Accredited Training Provider Association of Computer Trainers Valid HTML 4.01 Transitional
Valid CSS Markup

secure online payments - visa - mastercard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Training by application Main information pages See also

Access courses
DreamWeaver courses
Excel courses
MS Project courses
Outlook courses
PowerPoint courses
VBA courses
Word courses
(more...)

Public scheduled courses
On-site training
Closed company courses

Microsoft Office training
Pricing and availability
Training schedule
Training venues

Access training
Dreamweaver training
Excel training
MS Project training
PowerPoint training

London Computer Training
Computer Training London

Microsoft Access training
Microsoft Excel training
Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training

Time Management Course London

Interested in Access training? Please see the following pages:
microsoft access courses · microsoft training access course
microsoft+access+training · access courses in london

Training Information

Training Articles

AddThis Social Bookmark Button What's this?
Add to Del.icio.us Add to Facebook Add to Digg Add to Reddit Add to Google Add to Yahoo Add to Diigo Add to Mr. Wong Add to Linkarena Add to Power Oldie Add to Folkd Add to Jumptags Add to Upchuckr Add to Simpy Add to StumbleUpon Add to Slashdot Add to Netscape Add to Furl Add to Spurl Add to Blinklist Add to Blogmarks Add to Technorati Add to Newsvine Add to Blinkbits Add to Ma.Gnolia Add to Smarking Add to Netvouz