<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>formulas on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/formulas/</link>
    <description>Recent content in formulas on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 06 May 2023 04:53:37 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/formulas/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>My first LAMBDA in Excel</title>
      <link>https://www.s-anand.net/blog/my-first-lambda-in-excel/</link>
      <pubDate>Sat, 06 May 2023 04:53:37 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/my-first-lambda-in-excel/</guid>
      <description>&lt;p&gt;&lt;img alt=&#34;My first LAMBDA in Excel&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/image-75.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt;Ever since Excel introduced the LAMBDA function, I&#39;ve been itching to use it in real life. I got my first chance today.&lt;/p&gt;
&lt;p&gt;We track the skill index of our different teams (consulting, analytics, technology, etc.) like this:&lt;/p&gt;
&lt;figure class=&#34;wp-block-table&#34;&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Team&lt;/th&gt;&lt;th class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;Skill Index&lt;/th&gt;&lt;th class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;Apr-23&lt;/th&gt;&lt;th class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;May-23&lt;/th&gt;&lt;th class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;Jun-23&lt;/th&gt;&lt;th class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;Jul-23&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Consulting&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;0%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;0%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Analytics&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;33%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;33%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Technology&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;72%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;72%&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;etc.&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;td class=&#34;has-text-align-right&#34; data-align=&#34;right&#34;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/figure&gt;
&lt;p&gt;The &#34;Skill Index&#34; column should pick the LAST value. If Apr-23 is filled, use that. But if May-23 is also filled, use that.&lt;/p&gt;
&lt;p&gt;I needed something like a &lt;code&gt;=LASTVALUE(range)&lt;/code&gt; formula. But none exists.&lt;/p&gt;
&lt;p&gt;A good alternative is &lt;a href=&#34;https://exceljet.net/formulas/get-value-of-last-non-empty-cell&#34;&gt;this formula to get the last non-empty cell&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-excel&#34; data-lang=&#34;excel&#34;&gt;=LOOKUP(2,1/(range&amp;lt;&amp;gt;&amp;#34;&amp;#34;),range)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, I followed the &lt;a href=&#34;https://support.microsoft.com/en-us/office/lambda-function-bd212d27-1cd1-4321-a34a-ccbf254b8b67&#34;&gt;instructions&lt;/a&gt; to create a function in the Name Manager (Ctrl+F3)&lt;/p&gt;
&lt;p&gt;&lt;img loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/image-75.webp&#34;&gt;&lt;/p&gt;
&lt;p&gt; ... and simply fill in &lt;code&gt;=LASTVALUE(H6:S6)&lt;/code&gt; and the like in the &#34;Skills Index&#34; cell.&lt;/p&gt;
&lt;p&gt;The LOOKUP formula is confusing. My aim is to confuse our team less. But I wonder if they&#39;ll start Google-ing for this LASTVALUE formula no one ever heard of, and get more confused 🤔.&lt;/p&gt;
</description>
    </item>
    <item>
      <title>In-cell Excel charts</title>
      <link>https://www.s-anand.net/blog/in-cell-excel-charts/</link>
      <pubDate>Thu, 17 Aug 2006 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/in-cell-excel-charts/</guid>
      <description>&lt;p&gt;Juice analytics has some &lt;a href=&#34;http://www.juiceanalytics.com/weblog/index.php?tag=excel&#34;&gt;Excel graphing&lt;/a&gt; tips. You can make charts like below without using charts, using just text.&lt;/p&gt;
&lt;p&gt;These are useful because the charts are aligned with the data.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-excel-gantt-charts-using-just-text_217629714_o-gif.webp&#34;&gt;&lt;img alt=&#34;Excel Gantt charts using just text&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-excel-gantt-charts-using-just-text_217629714_o-gif.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-excel-bar-charts-using-just-text_217629715_o-gif.webp&#34;&gt;&lt;img alt=&#34;Excel bar charts using just text&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-excel-bar-charts-using-just-text_217629715_o-gif.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I once used a similar technique to display people&amp;rsquo;s staffing position. The sheet below lists people, projects they&amp;rsquo;re on and how long they&amp;rsquo;ll be on. The coloured cells to the right are a calendar display of the same stuff. Makes it easy to read.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan-without-using-charts_217642002_o-png.webp&#34;&gt;&lt;img alt=&#34;Excel Staffing Plan without using charts&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan-without-using-charts_217642002_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The trick is to place each week for each person as a thin cell, like below. Then the cell is populated with a formula that makes it 0 or 1 depending on whether the person is available that week or not. (The blue row #2 stores the start date of the week, and I compare this with the end date of each person&amp;rsquo;s project.)&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan---formula_217642004_o-png.webp&#34;&gt;&lt;img alt=&#34;Excel Staffing Plan - formula&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan---formula_217642004_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And then, you can turn on conditional formatting.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan---conditional-formatting_217642003_o-png.webp&#34;&gt;&lt;img alt=&#34;Excel Staffing Plan - conditional formatting&#34; loading=&#34;lazy&#34; src=&#34;https://www.s-anand.net/blog/assets/flickr-excel-staffing-plan---conditional-formatting_217642003_o-png.webp&#34;&gt;&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    <item>
      <title>Excel - Avoid manual labour</title>
      <link>https://www.s-anand.net/blog/excel-avoid-manual-labour/</link>
      <pubDate>Thu, 17 Nov 2005 12:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/excel-avoid-manual-labour/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Rule #3: Avoid manual labour&lt;/strong&gt;. Use Excel to automate the task.&lt;/p&gt;
&lt;p&gt;I use Excel&amp;rsquo;s formulas to speed up repetitous tasks. These techniques are &lt;strong&gt;powerful&lt;/strong&gt;, meaning, you can do a lot with a little, but can have unforeseen consequences.&lt;/p&gt;
&lt;p&gt;Excel can &lt;strong&gt;find and replace formulas&lt;/strong&gt;. If you had hardcoded formulas and wanted to change =B1*3.14 to =B1*3.1416 across all rows, just find &amp;ldquo;*3.14&amp;rdquo; and replace it with &amp;ldquo;*3.1416&amp;rdquo;. Find and replace works in formulas. &lt;strong&gt;This is very powerful&lt;/strong&gt;. You can use it to change the source (e.g. change the source from column B to C by finding &amp;ldquo;=B&amp;rdquo; and replacing with &amp;ldquo;=C&amp;rdquo;) or even the formula (find and replace &amp;ldquo;SUM(&amp;rdquo; with &amp;ldquo;SUBTOTAL(9,&amp;rdquo;).&lt;/p&gt;
&lt;p&gt;You can also &lt;strong&gt;search and replace for errors&lt;/strong&gt; (like #N/A, #REF, etc). In the Find dialog options, select &amp;ldquo;Values&amp;rdquo; under the Look in&amp;quot; option. To replace these cells, copy and paste the cells by value (Ctrl-C, go where you want to paste, Alt-E-S-V-Enter). Now you can search and replace #N/A just like any other value.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Find external links&lt;/strong&gt;. If you have links to other Excel files, and one of them is missing, you&amp;rsquo;ll get an error saying &amp;ldquo;This workbook contains links &amp;hellip;&amp;rdquo; It&amp;rsquo;s annoying, and difficult to trace the source. But since links to external files have the formula =Path[file]Sheet!Cell, just search for &amp;ldquo;[&amp;rdquo; across sheets (you can search across sheets using the Options button).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Format based on value&lt;/strong&gt;. &lt;strong&gt;Conditional formatting (Alt-O-D) accepts formulas&lt;/strong&gt;. You can set a cell&amp;rsquo;s background to red, yellow or green if it&amp;rsquo;s value is low, medium or high. Pick a cell, say D3. In conditional formatting, select &amp;ldquo;Formula is&amp;rdquo; instead of &amp;ldquo;Cell value is&amp;rdquo;, and type &amp;ldquo;=D3&amp;lt;10&amp;rdquo;. Set the format to a red background. Copy the formatting to all the cells (use the Format Painter button, or Edit-Paste Special-Formats). All cells less than 10 will have a red background. &lt;strong&gt;This is powerful&lt;/strong&gt; because you can use any formula based on any cell. For example, you could pick the conditional formatting formula &amp;ldquo;=$C3&amp;lt;10&amp;rdquo; for the cell D3. The cell becomes red if the cell to its left is less than 10. Best of all, you can say &amp;ldquo;=$C3&amp;lt;$A$1&amp;rdquo;. As you change the value in cell A1, the colours change automatically. Since you can copy and paste the formatting alone (Edit - Paste Special - Format), you can set the conditional format in one cell, and copy &amp;amp; paste it across any selection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remove unwanted rows&lt;/strong&gt;. Sometimes, when you import data, you have empty rows, or errors or whatever. To delete empty rows, select the data, go to Data - Filter - Autofilter. Click on one of the arrow buttons, and select the &amp;ldquo;(Blank)&amp;rdquo;. This will display all the blank rows. Select them all and delete them. If you want to delete rows with errors, click the arrow button, select whichever values are errors, and delete those rows. If you want to delete rows based on some other criteria, create a new column that shows TRUE or FALSE based on the criteria, do the Autofilter, and delete the rows.&lt;/p&gt;
&lt;p&gt;An alternative to Autofilter is to sort the data based on the column you want. All blank rows (or errors, etc) will be grouped together, and you can delete them at one shot.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&#34;comments&#34;&gt;Comments&lt;/h2&gt;
&lt;!-- wp-comments-start --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ahmed&lt;/strong&gt; &lt;em&gt;17 Nov 2005 12:00 pm&lt;/em&gt;:
what`s the meaning of $ in the cell that comes before the cell location like $A$3 thanx a lot&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Kannan&lt;/strong&gt; &lt;em&gt;17 Nov 2005 12:00 pm&lt;/em&gt;:
To find the links, go to Edit and Links - You can find the external links instead of search.&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- wp-comments-end --&gt;
</description>
    </item>
  </channel>
</rss>
