{"id":799,"date":"2017-06-09T01:19:07","date_gmt":"2017-06-08T19:19:07","guid":{"rendered":"http:\/\/xlfxs.com\/?p=799"},"modified":"2017-06-09T01:19:07","modified_gmt":"2017-06-08T19:19:07","slug":"offsetmatch","status":"publish","type":"post","link":"https:\/\/xlfxs.com\/?p=799","title":{"rendered":"OFFSET+MATCH"},"content":{"rendered":"<p>One of the power of combining functions in one cell is using the best of these functions<\/p>\n<p>An example is here, OFFSET + MATCH will allow you to do something similar to VLOOKUP.<\/p>\n<h3>Why do we want to do that?<\/h3>\n<p>VLOOKUP will search in the left-most column in a table to get a value from a column on the right. But this is not the situation all the time<\/p>\n<p>We needed several times to locate a row by using a column on the right, then get the value from a column left to it.<\/p>\n<p>This is when VLOOKUP can not help us.<\/p>\n<p><!--more--><\/p>\n<p>And this is when a combined function like OFFSET + MATCH can get the job done.<\/p>\n<p>So, if we have a table as below<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1083\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs3-163x300.png\" alt=\"\" width=\"142\" height=\"261\"><\/a><\/p>\n<p>A simple VLOOKUP can help us find any of these values, say &#8220;Test_Country&#8221;<\/p>\n<pre>=VLOOKUP(\"Test_Country\",AB:AC,2,FALSE)<\/pre>\n<p>Which will return the expected result.<\/p>\n<p>However, a table as below, we cannot use VLOOKUP if we want to search using &#8220;TreeKey&#8221; column, or &#8220;UnitID&#8221;, basically any column on the right of the table<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-1085\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs4-231x300.png\" alt=\"\" width=\"231\" height=\"300\"><\/a><\/p>\n<p>Since VLOOKUP searches only left-most column of table.<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1086 size-full\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs5.png\" alt=\"\" width=\"224\" height=\"190\"><\/a><\/p>\n<p>And if we try using -ve number in &#8220;Col_index_num&#8221; we get an error<\/p>\n<p>&nbsp;<a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-1087\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2017\/06\/xlfxs6.png\" alt=\"\" width=\"336\" height=\"106\"><\/a><\/p>\n<h3>So, what can we do?<\/h3>\n<p>Use combination of OFFSET and MATCH<\/p>\n<p>MATCH will do the actual search in the needed column, while OFFSET gives me the actual return as below<\/p>\n<p>below example will search for &#8220;T1_3_1_9&#8221; in column &#8220;TreeKey&#8221; column and returns the &#8220;PVID&#8221; of that item<\/p>\n<pre>=OFFSET($DM$1,MATCH(\"T1_3_1_9\",DR:DR,0),2)<\/pre>\n<p>Or, we can search for &#8220;FC12_1B500733244144&#8221; in &#8220;UnitID&#8221; column and return its &#8220;PVID&#8221; as below<\/p>\n<pre>=OFFSET($DM$1,MATCH(\"FC12_1B500733244144\",DP:DP,0),2)<\/pre>\n<p>Hope this will help<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the power of combining functions in one cell is using the best of these functions An example is here, OFFSET + MATCH will allow you to do something similar to VLOOKUP. Why do we want to do that? VLOOKUP will search in the left-most column in a table to get a value from&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/xlfxs.com\/?p=799\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;OFFSET+MATCH&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1088,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,36,37,47,6],"tags":[158,173,206],"class_list":["post-799","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-formulas","category-lookup_and_references","category-match","category-offset","category-standard_functions","tag-match","tag-offset","tag-vlookup"],"_links":{"self":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=799"}],"version-history":[{"count":0,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/799\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/media\/1088"}],"wp:attachment":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}