{"id":334,"date":"2022-01-28T04:11:33","date_gmt":"2022-01-28T04:11:33","guid":{"rendered":"http:\/\/miriamposner.com\/classes\/is270s23\/?page_id=334"},"modified":"2022-01-28T04:45:20","modified_gmt":"2022-01-28T04:45:20","slug":"use-the-vlookup-function-in-excel","status":"publish","type":"page","link":"http:\/\/miriamposner.com\/classes\/is270s23\/organizing-data\/use-the-vlookup-function-in-excel\/","title":{"rendered":"<a>Use the VLOOKUP function in Excel<\/a>"},"content":{"rendered":"\n<p><em>You can <a rel=\"noreferrer noopener\" href=\"https:\/\/share.descript.com\/view\/BhErhNMID1y\" target=\"_blank\">watch me perform these steps on video<\/a>.<\/em><\/p>\n\n\n\n<p>V-what? It may have an odd name, but the VLOOKUP function in Excel can be a real lifesaver. In brief, it grabs values from one location, matches them up with the corresponding values in a different location, and fills in a column with the information from the first location. Still confused? Let&#8217;s look at an example.<\/p>\n\n\n\n<p>An aside: There&#8217;s a newer version of VLOOKUP, called XLOOKUP, in the latest versions of Excel. But since they&#8217;re pretty similar and you might not have that version of Excel, we&#8217;ll stick with VLOOKUP for now.<a><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"why-you-might-find-it-useful\">Why you might find it useful<\/h2>\n\n\n\n<p>Here&#8217;s my spreadsheet listing the locations and dates of traffic accidents in Boston. I&#8217;d really like to show in which season the accidents occurred. But that information isn&#8217;t in my spreadsheet; I only have months and days. I do, however, have a separate list of months (identified by number) and their corresponding seasons, like this:<\/p>\n\n\n\n<p>1: Winter<\/p>\n\n\n\n<p>2: Winter<\/p>\n\n\n\n<p>3: Spring<\/p>\n\n\n\n<p>[etc.]<\/p>\n\n\n\n<p>So how do I get a new Seasons column that uses my list of months and seasons to tell me in which season each accident occurred? Is my only option to painstakingly enter all the seasons by hand? Of course not! This is where the VLOOKUP comes in. You&#8217;ll instruct Excel to refer to your list of seasons to automatically fill out a new seasons column according to the corresponding month.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"744\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful-1024x744.png\" alt=\"\" class=\"wp-image-335\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful-1024x744.png 1024w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful-300x218.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful-768x558.png 768w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful-160x116.png 160w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/why-you-might-find-it-useful.png 1500w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"some-terminology\">Some terminology<\/h2>\n\n\n\n<p>To help specify which data we&#8217;re talking about, let&#8217;s call our big dataset\u2014the list of car accidents\u2014<strong>raw data<\/strong>. And we&#8217;ll call our list of seasons and corresponding months <strong>our lookup table<\/strong>. In order for VLOOKUP to be useful, your two tables must have one column with the same kind of data in it. In our case, that&#8217;s the month column. We&#8217;ll call that the <strong>key<\/strong>, since it &#8220;unlocks&#8221; the relationship between the two tables.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"848\" height=\"618\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/some-terminology.png\" alt=\"\" class=\"wp-image-336\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/some-terminology.png 848w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/some-terminology-300x219.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/some-terminology-768x560.png 768w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/some-terminology-159x116.png 159w\" sizes=\"auto, (max-width: 848px) 100vw, 848px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"insert-a-new-column\">Insert a new column<\/h2>\n\n\n\n<p>Let&#8217;s create a new column in our raw data table, to hold the season information we&#8217;re going to import. Click on a cell in column E. Then, either right-click your mouse, or press control and click with your keyboard, to view a pop-up menu. From that pop-up menu, select <strong>Insert&#8230;<\/strong> Finally, from the <strong>Insert<\/strong> pop-up window, select <strong>Entire column<\/strong> and press <strong>OK<\/strong>. This adds a blank column to your existing data. (Actually, this new, blank column could go anywhere in your table, but it&#8217;s nice if it&#8217;s close to the <strong>MONTH<\/strong> column.)<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"630\" height=\"562\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/insert-a-new-column.png\" alt=\"\" class=\"wp-image-337\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/insert-a-new-column.png 630w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/insert-a-new-column-300x268.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/insert-a-new-column-130x116.png 130w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"label-your-new-column\">Label your new column<\/h2>\n\n\n\n<p>We always put our column names at the top! So in the top-most cell of the column you just created, enter the name for that column: SEASON.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"440\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/label-your-new-column.png\" alt=\"\" class=\"wp-image-338\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/label-your-new-column.png 596w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/label-your-new-column-300x221.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/label-your-new-column-157x116.png 157w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-vlookup-formula\">The VLOOKUP formula<\/h2>\n\n\n\n<p>We&#8217;re about to type a formula into the first cell in column <strong>E<\/strong>. But before we do, let&#8217;s look at what information Excel is expecting. When you specify the VLOOKUP formula, Excel is expecting you to tell it:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\"><li>Which cell contains the first value you want Excel to look up?<\/li><li>Which table is the lookup table?<\/li><li>In the lookup table, which column contains the information you want in your new column? (Use a number to specify the column.)<\/li><li>Is an approximate match OK, or do you need an exact match?<\/li><\/ol>\n\n\n\n<p>Notice that the formula expects you to enter each piece of information followed by a comma, with a parentheses around the entire set of variables. If this seems overwhelming, don&#8217;t worry. It makes more sense when you actually do it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"570\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula-1024x570.png\" alt=\"\" class=\"wp-image-339\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula-1024x570.png 1024w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula-300x167.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula-768x428.png 768w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula-208x116.png 208w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/the-vlookup-formula.png 1498w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"enter-the-vlookup-formula\">Enter the VLOOKUP formula<\/h2>\n\n\n\n<p>Click on the first empty cell in your new SEASONS column. In Excel, you indicate that you&#8217;re typing a formula by beginning with an equals sign (=). So type that, followed by <strong>VLOOKUP<\/strong> to specify the formula you&#8217;re using.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Then open the parentheses and enter the cell coordinates for the first value you want Excel to look up. In my case, that&#8217;s the first cell in the MONTH column. I can indicate that by either typing <strong>C2<\/strong> or just clicking on that cell with my mouse. Then type a comma.<\/li><li>Next, we need to tell Excel where to go to get the information you want it to fill in. Do this by clicking on the <strong>Season Lookup <\/strong>tab to open the Season Lookup worksheet, and then using your mouse to select the entire lookup table. Then type a comma.<\/li><li>Next, we need to tell Excel which column in the lookup table contains the information we want to fill our new SEASONS column with. Type <strong>2<\/strong> to indicate that the appropriate column is the second one over from the left. Then type a comma.<\/li><li>Finally, tell Excel whether an approximate match is OK. Type or select <strong>FALSE<\/strong> (or <strong>0<\/strong>) to indicate that you want an exact match.<\/li><li>Then close the parentheses.<\/li><\/ul>\n\n\n\n<p>To summarize, your formula should look like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=VLOOKUP(C2,'Season Lookup'!A1:B13,2,FALSE)<\/pre>\n\n\n\n<p>If you did it right, and you press return, you should find that the first cell of your SEASON column contains the word <strong>Winter<\/strong>!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"994\" height=\"366\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/enter-the-vlookup-formula.png\" alt=\"\" class=\"wp-image-340\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/enter-the-vlookup-formula.png 994w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/enter-the-vlookup-formula-300x110.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/enter-the-vlookup-formula-768x283.png 768w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/enter-the-vlookup-formula-228x84.png 228w\" sizes=\"auto, (max-width: 994px) 100vw, 994px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a-tricky-but-critical-extra-step\">A tricky but critical extra step<\/h2>\n\n\n\n<p>You did the hard part! Now we want to copy the formula to the entire column. But there&#8217;s one extra step we need to take!<\/p>\n\n\n\n<p>When you paste a formula into a new cell, Excel, by default, adjusts the locations of the cells you specify to reflect the new location. For example, <strong>C2<\/strong> in the above formula becomes <strong>C3<\/strong>, to indicate that you&#8217;re referring to the value in the next row down.<\/p>\n\n\n\n<p>Usually, that&#8217;s helpful. But while we want Excel to adjust the value in the <strong>lookup_array<\/strong>, we <em>don&#8217;t<\/em>want it to adjust the <strong>table_array <\/strong>(the table that contains our seasons list). We want that to remain the same in every row of the column.<\/p>\n\n\n\n<p>To tell Excel not to mess with the table array, we need to turn our currently <strong>relative cell reference<\/strong> into an <strong>absolute cell reference<\/strong>. To do this, we&#8217;ll add a dollar sign ($) in front of every character in the cell reference in the table_array portion of your formula. It should look like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=VLOOKUP(C2,'Season Lookup'!$A$1:$B$13,2,0)<\/pre>\n\n\n\n<p>Now, if you click on cell E2 and then use the green handles to fill in a few rows below, you&#8217;ll see that Excel uses the correct range for its table array.<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"fill-the-entire-column-with-your-formula\">Fill the entire column with your formula<\/h2>\n\n\n\n<p>Now the final step: Fill in the entire column with your formula. You <em>could<\/em> do this by dragging the green box all the way down, but that would take forever. Let&#8217;s do it the easier way.<\/p>\n\n\n\n<p>Click on the last cell you &#8220;filled in&#8221; in the SEASON column. (For me, that&#8217;s E5, because I dragged the green box down a few rows.) That will reveal that green box again. Now, carefully move your cursor so that it hovers over the handle at the lower right-hand corner of the green box. You can tell you&#8217;re in the right place because the white plus sign that indicates your cursor will turn black.<\/p>\n\n\n\n<p>Now, double-click. And <em>voila<\/em>, you have a column full of seasons!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"524\" src=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/fill-the-entire-column-with-your-formula.png\" alt=\"\" class=\"wp-image-341\" srcset=\"http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/fill-the-entire-column-with-your-formula.png 764w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/fill-the-entire-column-with-your-formula-300x206.png 300w, http:\/\/miriamposner.com\/classes\/is270s23\/wp-content\/uploads\/sites\/23\/2022\/01\/fill-the-entire-column-with-your-formula-169x116.png 169w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>You can watch me perform these steps on video. V-what? It may have an odd name, but the VLOOKUP function in Excel can be a real lifesaver. In brief, it&hellip; <a class=\"more-link\" href=\"http:\/\/miriamposner.com\/classes\/is270s23\/organizing-data\/use-the-vlookup-function-in-excel\/\">Continue reading <span class=\"screen-reader-text\"><a>Use the VLOOKUP function in Excel<\/a><\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":328,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","footnotes":""},"class_list":["post-334","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/pages\/334","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/comments?post=334"}],"version-history":[{"count":0,"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/pages\/334\/revisions"}],"up":[{"embeddable":true,"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/pages\/328"}],"wp:attachment":[{"href":"http:\/\/miriamposner.com\/classes\/is270s23\/wp-json\/wp\/v2\/media?parent=334"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}