{"id":621,"date":"2018-07-07T17:04:06","date_gmt":"2018-07-07T22:04:06","guid":{"rendered":"https:\/\/linux.asberry.org\/blog_tech\/?p=621"},"modified":"2022-05-14T09:13:03","modified_gmt":"2022-05-14T14:13:03","slug":"excel-vlookup","status":"publish","type":"post","link":"https:\/\/asberry.org\/blog_tech\/?p=621","title":{"rendered":"Excel &#8211; VLOOKUP"},"content":{"rendered":"<p>Okay if you read this blog you&#8217;ll know I&#8217;m more of a DB geek than an Excel user but I&#8217;m getting tired of every time that I want to do a quick sub-out of data having to load not one but two files into the DB and then write the query to join the two and get what I need. It&#8217;s a great way to go but awfully time consuming if it&#8217;s not going to be built into a SSIS pack or something of the sort.<br \/>\nSo that brings us to the old standard Excel. Actually Excel is awfully handy on the export side of things but using it to import data from a DB or even flat file.<br \/>\nIn this case we&#8217;ve got two sheets representing two tables with a common key.<\/p>\n<ul>\n<li>=VLOOKUP(F2,States!A$2:B$38,2)<\/li>\n<li>The $ keeps the range in the middle from moving when you populate down.<\/li>\n<li>In this case this is done in G2 where F2 is being looked up.<\/li>\n<li>The range is on a second sheet from A2 to B38 where items in A relate to F and the B value will be returned for G.<\/li>\n<li>Remember to have the columns in the same order to pull this off.<\/li>\n<\/ul>\n<p>Just to note, if you are looking at using a field with a tilde, you have to escape it, which looks like this:<\/p>\n<p>=VLOOKUP(SUBSTITUTE(B2,&#8221;~&#8221;,&#8221;~~&#8221;),Sheet1!A$2:B$234,2,FALSE)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Okay if you read this blog you&#8217;ll know I&#8217;m more of a DB geek than an Excel user but I&#8217;m getting tired of every time that I want to do a quick sub-out of data having to load not one but two files into the DB and then write the query to join the two [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[10],"tags":[],"class_list":["post-621","post","type-post","status-publish","format-standard","hentry","category-mssql","author-aron"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4bBkH-a1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=621"}],"version-history":[{"count":3,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/621\/revisions"}],"predecessor-version":[{"id":689,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=\/wp\/v2\/posts\/621\/revisions\/689"}],"wp:attachment":[{"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asberry.org\/blog_tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}