<img src="//bat.bing.com/action/0?ti=5794969&amp;Ver=2" height="0" width="0" style="display:none; visibility: hidden;">

Using a VLOOKUP in Excel to Simplify Large Data Searches

[fa icon="long-arrow-left"] Back to all posts

[fa icon="pencil'] Posted by Lewan Solutions [fa icon="calendar"] July 13, 2012

This post covers a very handy formula in Excel, the VLOOKUP. The VLOOKUP can radically simplify processing between two separate spreadsheets with lots of data that needs to be compared. Working in an operations environment, this can be a real life saver! Here's an example: I generally use this function when comparing device inventories from several different people. Everyone has a slightly different set on information based on their perspective and job function, and I need a master list that satisfies everyone. (Or anyone--no one really reads spreadsheets anyways...)

Enough of the description, on to the details.

Starting with a set of information, called "Set A" going forward:

You could say that set A is the foundation or 'primary' set of information, as it will remain in this format, while our second set of data, "Set B" will be compared against this data.

Our VLOOKUP will output to the right of this data (at least the way I have set it up here), so it's important that set A has all of the information that we care about in it. The VLOOKUP will only compare against what we have selected in set A, so to find a true comparison we would need to run the VLOOKUP twice, once using set A as the primary and once using set B as the primary.

We additionally want to bring both of our sets of data together--they don't need to be on the same spreadsheet, but having them in the same workbook really simplifies things. To do this, open your second data set and right click on the spreadsheet tab in the bottom left corner, then select "Move or Copy".

This brings up a box asking where to move the spreadsheet--we want to move it to the same workbook as our spreadsheet with data set A. Select the drop down below "To book:" and select the correct workbook. This should combine both spreadsheets onto the same workbook, like so:

Our next step is to insert a column to the right of Column C on our primary spreadsheet (with set A). I put the VLOOKUP to the right of my primary data set because it makes it easier to look at.

In the now blank column to the right of our dataset, we insert the VLOOKUP. The simplest way to do this is select "Formulas" in the Excel Ribbon, then "Insert Function". This brings up a search window where you can search for VLOOKUP. After excel locates this function, select OK to bring up the VLOOKUP function box.

The first box, 'Lookup_value', is going to contain data set A. In this example, I want to select all of column 'C', as this is my primary data set. You can enter that manually, as C:C, or CX:CY (with X and Y being replaced by a top and bottom row number, respectively), or just highlight all of column C with your mouse.

The next box, 'Table_array', is going to be used for data set B. This is the data that will be compared with data set A. Note: You can select multiple columns in table_array! This can be very useful when you want to return a value that is associated with a searched value. I'll cover this in another post, since it's worthy of being addressed by itself. In this example, I'm selecting column C from my second spreadsheet tab. Excel formats this with the name of the spreadsheet, followed by '!', followed by the column or values that I want.

The next box, 'Col_index_num', is asking for the column (from left to right) that we want to return from 'Table_array'. This would be important if we were searching a larger table (multiple columns), but, as it is now, '1' is the only possibility.

Finally, 'Range_lookup' asks for either a 'TRUE' or 'FALSE' value. This wants to know whether or not we need an exact match: TRUE finds the "closest" match (which I have never found to work, at all), while FALSE forces an exact match. I'm using FALSE in this example, because I need to have an exact match. Be careful with this, as even slight differences or errors will throw off your VLOOKUP.

Select OK and this should run the VLOOKUP for this specific field. If there is a match, you will see a duplication of the data from set A in the box with your VLOOKUP. In this case, it has found a matching value and is returning it.

If it does not find a match, it will return '#N/A'. The next step is to copy the formula and drag it to the rest of the column, and voila!

We have vastly simplified a process that would normally take hours of manually checking one column versus another.

Questions? Comments? Did this totally fail for you? Let me know and I can try to address why it might not have worked.

Topics: How To Guide

Lewan Solutions
Written by Lewan Solutions

  • View & Submit Comments

[fa icon="envelope"] Subscribe to Email Updates



[fa icon="comments-o"] Follow us

Get even more great content, photos, event info and industry news.



[fa icon="calendar"] Recent Posts