{"id":63,"date":"2010-12-08T13:29:13","date_gmt":"2010-12-08T12:29:13","guid":{"rendered":"http:\/\/mariaevert.dk\/vba\/?p=63"},"modified":"2010-12-08T13:30:20","modified_gmt":"2010-12-08T12:30:20","slug":"excel-formula-miscellaneous","status":"publish","type":"post","link":"https:\/\/mariaevert.dk\/vba\/?p=63","title":{"rendered":"Excel formula &#8211; Miscellaneous"},"content":{"rendered":"<p>I recently had to work with Excel formulas, and I encountered a small challenge. The problem was this: I had a table with variating height (the user could add and delete rows), that was likely to sometimes have 0 rows.Also, it wasn&#8217;t just the sum of the whole column I needed, as the SUM value should be at the bottom of the table, and a circular loop should be avoided. Therefore, the usual SUM() didn&#8217;t work.<\/p>\n<p>I did not want to use VBA for this problem, so I turned to this solution: <\/p>\n<p>Example: Column A: Names &#8211; Column B: Salary<\/p>\n<p>1) Find the last cells that isn&#8217;t empty (in column A).<br \/>\n2) Make a SUM()-formula in column B that can take the row number from 1) as a parameter. <\/p>\n<p>1) (Danish)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=(SUMPRODUKT(MAKS((A4:A65003&lt;&gt;&quot;&quot;)*R\u00c6KKE(A4:A65003)))) \r\n<\/pre>\n<p>(English)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=(SUMPRODUCT(MAX((A4:A65003&lt;&gt;&quot;&quot;)*ROW(A4:A65003))))\r\n<\/pre>\n<p>To make the solution understandable, I will enter the above formula in cell G1. Now, I have defined the last row(G1), and I just need a fixed first row, which I define as 2:    I need to use the SUM() and the INDEKS() to sum the variable amount of rows: <\/p>\n<p>(Danish)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=SUM(INDEKS(B:B;2):INDEKS(B:B;G1))\r\n<\/pre>\n<p>(English)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=SUM(INDEX(B:B;2):INDEX(B:B;G1))\r\n<\/pre>\n<p>Of course, put togther, it looks like this: <\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n=SUM(INDEKS(B:B;2):INDEKS(B:B;(=(SUMPRODUKT(MAKS((A4:A65003&lt;&gt;&quot;&quot;)*R\u00c6KKE(A4:A65003)))) )))\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently had to work with Excel formulas, and I encountered a small challenge. The problem was this: I had a table with variating height (the user could add and delete rows), that was likely to sometimes have 0 rows.Also, it wasn&#8217;t just the sum of the whole column I needed, as the SUM value [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/posts\/63"}],"collection":[{"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=63"}],"version-history":[{"count":11,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=\/wp\/v2\/posts\/63\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariaevert.dk\/vba\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}