{"id":555,"date":"2016-09-26T19:37:45","date_gmt":"2016-09-26T19:37:45","guid":{"rendered":"http:\/\/xlfxs.com\/?p=555"},"modified":"2016-09-26T19:37:45","modified_gmt":"2016-09-26T19:37:45","slug":"dynamic-links-between-two-workbooks","status":"publish","type":"post","link":"https:\/\/xlfxs.com\/?p=555","title":{"rendered":"Links between two workbooks &#8211; dynamically using functions"},"content":{"rendered":"<p>I don&#8217;t believe I don&#8217;t have this here yet. This is one of my oldest tricks<\/p>\n<p>When we have to do links between two workbooks (One cell in Workbook1 to have value updated from a\u00a0cell in\u00a0Workbook2), we usually just do links like this&#8230;<\/p>\n<p>Go to workbook1, select a cell, type in &#8216;=&#8217; then go to Workbook2 and select a cell, then &#8216;ENTER&#8217;<\/p>\n<p>To get something like this<\/p>\n<p><a href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-556\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link1-300x191.png\" alt=\"link1\" width=\"236\" height=\"150\" \/><\/a><\/p>\n<p>Which will look like this if try1.xlsx is closed<\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-557\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link2-300x129.png\" alt=\"link2\" width=\"251\" height=\"108\" \/><\/a><\/p>\n<p>However, if you open try2.xlsx alone before you open try1.xlsx, you get this message<\/p>\n<p><!--more--><\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-558\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link3-300x141.png\" alt=\"link3\" width=\"300\" height=\"141\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This means now try2.xlsx and try1.xlsx have a link between them<\/p>\n<p>In another word, try2.xlsx liknks to try1.xlsx<\/p>\n<p>Which is ok, but<\/p>\n<h3>Except, I don&#8217;t like that,<\/h3>\n<p>It will take me some time to refresh the link if I have moved that try1.xlsx to another location or rename it.<\/p>\n<p>So, what the solution?<\/p>\n<h2><span style=\"text-decoration: underline;\">Dynamic link<\/span><\/h2>\n<p>Which basically, create a link between those two without the mess, and Excel will not recognize it as a link and will stop complaining.<\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-564\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link7-300x80.png\" alt=\"link7\" width=\"454\" height=\"121\" \/><\/a><\/p>\n<h3>How?<\/h3>\n<p>Using the function =INDIRECT(), one of my favorites.<\/p>\n<p>So, in above example, we break in the link inside C12 into pieces, like below<\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-560\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link4-300x185.png\" alt=\"link4\" width=\"300\" height=\"185\" \/><\/a><\/p>\n<p>So, C4 has the full folder location of our workbook try1.xlsx<\/p>\n<p>C5 has the file name<\/p>\n<p>C6 has the sheet name<\/p>\n<p>And C7 has the cell<\/p>\n<p>Now, we combine them back into full path as we found it originally into cell C8<\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-561\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link5-300x186.png\" alt=\"link5\" width=\"300\" height=\"186\" \/><\/a><\/p>\n<p>By adding the required characters to make it look exactly how INDIRECT expects it<\/p>\n<p>Then, finally, we use it inside INDIRECT<\/p>\n<p><a class=\"fancybox\" href=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-562\" src=\"http:\/\/xlfxs.com\/wp-content\/uploads\/2016\/09\/Link6-300x182.png\" alt=\"link6\" width=\"300\" height=\"182\" \/><\/a><\/p>\n<p>And here is the dynamic link<\/p>\n<h3>What is the gain?<\/h3>\n<p>Mostly, the flexibility of chagninng the references, if folder got changed (by moving the workbook) or name got change, by renaming it, or sheet, we can just type it in its box and press enter<\/p>\n<p>That particular workbook, has to be open to read the value.<\/p>\n<p>&nbsp;<\/p>\n<h3>What are other gains?<\/h3>\n<p>Well, think about dynamically reading numbers from multiple sheets into one, for example, you have sheet per project and you want to collect all these info from all these projects into a &#8216;summary&#8217; sheet, this dynamic link, can help you build one cell, then copy it to others to apply it there<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t believe I don&#8217;t have this here yet. This is one of my oldest tricks When we have to do links between two workbooks (One cell in Workbook1 to have value updated from a\u00a0cell in\u00a0Workbook2), we usually just do links like this&#8230; Go to workbook1, select a cell, type in &#8216;=&#8217; then go to&#8230;<\/p>\n<p class=\"more-link-wrap\"><a href=\"https:\/\/xlfxs.com\/?p=555\" class=\"more-link\">Read More<span class=\"screen-reader-text\"> &ldquo;Links between two workbooks &#8211; dynamically using functions&rdquo;<\/span> &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":556,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,36,6],"tags":[],"class_list":["post-555","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-indirect","category-lookup_and_references","category-standard_functions"],"_links":{"self":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/555","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=555"}],"version-history":[{"count":0,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/posts\/555\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=\/wp\/v2\/media\/556"}],"wp:attachment":[{"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlfxs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}