<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Useful Excel Tips</title>
	<atom:link href="http://anupagarwal.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://anupagarwal.wordpress.com</link>
	<description>The blog lists some of the excel functions that I have found useful</description>
	<lastBuildDate>Wed, 21 Jul 2010 11:06:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='anupagarwal.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Useful Excel Tips</title>
		<link>http://anupagarwal.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://anupagarwal.wordpress.com/osd.xml" title="Useful Excel Tips" />
	<atom:link rel='hub' href='http://anupagarwal.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Which Group does a name belong to?</title>
		<link>http://anupagarwal.wordpress.com/2010/07/21/which-group-does-a-name-belong-to/</link>
		<comments>http://anupagarwal.wordpress.com/2010/07/21/which-group-does-a-name-belong-to/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 10:54:34 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[isnumber]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sumproduct]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=315</guid>
		<description><![CDATA[Consider this problem The table above gives the groups in which each of the members belong. the problem here is to find out in which group one of the member belongs to e.g. Keith (A12). The formula used in B12 is =INDEX($A$1:$C$1,1,SUMPRODUCT(- -ISNUMBER(SEARCH(A12,$A$2:$C$8)),{1,2,3}*{1;1;1;1;1;1;1})) The way this works is Search function searches for Keith (A12) in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=315&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider this problem</p>
<p><a href="http://anupagarwal.files.wordpress.com/2010/07/tip37-check-the-header1.png"><img class="alignnone size-medium wp-image-317" title="tip37-check-the-header" src="http://anupagarwal.files.wordpress.com/2010/07/tip37-check-the-header1.png?w=217&#038;h=300" alt="" width="217" height="300" /></a></p>
<p>The table above gives the groups in which each of the members belong. the problem here is to find out in which group one of the member belongs to e.g. Keith (A12). The formula used in B12 is</p>
<p>=<span style="color:#0000ff;">INDEX</span>($A$1:$C$1,1,<span style="color:#0000ff;">SUMPRODUCT</span>(- -<span style="color:#0000ff;">ISNUMBER</span>(<span style="color:#0000ff;">SEARCH</span>(A12,$A$2:$C$8)),{1,2,3}*{1;1;1;1;1;1;1}))</p>
<p>The way this works is</p>
<ul>
<li>Search function searches for Keith (A12) in the array A2:C8. It returns #VALUE! for cells where Keith is not present and 1 for the cell in which Keith is present</li>
<li>Isnumber returns True for the cell in which Keith is present and False for the rest</li>
<li>Operator &#8211; - changes True and False to numbers 1 and 0 respectively</li>
<li>Thus we have an array of 0s and one 1 with 7 rows and 3 columns</li>
<li>We now generate an array with {1,2,3}*{1;1;1;1;1;1;1}. This array is of the form</li>
</ul>
<p><a href="http://anupagarwal.files.wordpress.com/2010/07/tip37-array.png"><img class="alignnone size-full wp-image-318" title="tip37-array" src="http://anupagarwal.files.wordpress.com/2010/07/tip37-array.png?w=165&#038;h=109" alt="" width="165" height="109" /></a></p>
<ul>
<li>Sumproduct multiplies the earlier generated array of 0 and 1 with our array such that it returns the column number of cell in which Keith is present &#8211; 2 in this case</li>
<li>Index simply returns the equivalent group from the header array A1:C1 &#8211; Lions in this case.</li>
</ul>
<p>Can you figure out a way of not putting the array manually by using the function row and column functions.</p>
<br /> Tagged: <a href='http://anupagarwal.wordpress.com/tag/index/'>index</a>, <a href='http://anupagarwal.wordpress.com/tag/isnumber/'>isnumber</a>, <a href='http://anupagarwal.wordpress.com/tag/search/'>search</a>, <a href='http://anupagarwal.wordpress.com/tag/sumproduct/'>sumproduct</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/315/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/315/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/315/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=315&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2010/07/21/which-group-does-a-name-belong-to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2010/07/tip37-check-the-header1.png?w=217" medium="image">
			<media:title type="html">tip37-check-the-header</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2010/07/tip37-array.png" medium="image">
			<media:title type="html">tip37-array</media:title>
		</media:content>
	</item>
		<item>
		<title>Lookup for &#8220;contains&#8221;</title>
		<link>http://anupagarwal.wordpress.com/2009/07/24/lookup-for-contains/</link>
		<comments>http://anupagarwal.wordpress.com/2009/07/24/lookup-for-contains/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 11:27:31 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[--]]></category>
		<category><![CDATA[isnumber]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[sumproduct]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=303</guid>
		<description><![CDATA[Here is a method for looking up &#8220;contains&#8221; from the lookup value array. Consider the problem below. I have sales figures for Asia Pacific countries. The lookup value extracted from the system is in the format &#8220;Country City&#8221; The expected results are given in the table D1:E11. Here is the solution using search and sumproduct. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=303&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a method for looking up &#8220;contains&#8221; from the lookup value array.<br />
Consider the problem below. I have sales figures for Asia Pacific countries. The lookup value extracted from the system is in the format &#8220;Country City&#8221;<br />
<img class="alignnone size-full wp-image-304" title="tip36-lookup_contains" src="http://anupagarwal.files.wordpress.com/2009/07/tip36-lookup_contains.png?w=396&#038;h=244" alt="tip36-lookup_contains" width="396" height="244" /></p>
<p>The expected results are given in the table D1:E11.</p>
<p>Here is the solution using search and sumproduct. You may use array function instead of sumproduct. Suit yourself.</p>
<p>E2=<span style="color:#0000ff;">SUMPRODUCT(––ISNUMBER(SEARCH(D2,CountryCity)),Sales)</span></p>
<p><span style="color:#000000;">where, <span style="color:#0000ff;">CountryCity</span> is A2:A14 and <span style="color:#0000ff;">Sales</span> is B2:B14</span></p>
<p><span style="color:#000000;">You do not need to change the formula while computing for a country figure. The same formula works perfectly.</span></p>
<p><span style="color:#000000;">Now, how does this formula work,</span></p>
<ul>
<li><span style="color:#000000;">Search function looks for the lookup city or country in all cells of <span style="color:#0000ff;">CountryCity<span style="color:#000000;">. (You could use Find function but it is case-sensitive). For cells which contains the lookup city or country it returns a number</span></span></span></li>
<li><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Isnumber converts this to True for cells containing the lookup value. Rest are False</span></span></span></li>
<li><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">The operator –– converts True to 1 and False to 0 (<a href="http://anupagarwal.wordpress.com/2009/07/10/the-trick-of/">Refer earlier post</a>)</span></span></span></li>
<li><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Sumproduct multiplies the array of 1&#8242;s and 0&#8242;s with the Sales array and returns the summation of Sales figure where the &#8220;contains&#8221; for lookup value is True</span></span></span></li>
</ul>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Have a great weekend <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></span></span></p>
<br /> Tagged: --, isnumber, search, sumproduct <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/303/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=303&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/07/24/lookup-for-contains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip36-lookup_contains.png" medium="image">
			<media:title type="html">tip36-lookup_contains</media:title>
		</media:content>
	</item>
		<item>
		<title>Cell value from a grid</title>
		<link>http://anupagarwal.wordpress.com/2009/07/16/cell-value-from-a-grid/</link>
		<comments>http://anupagarwal.wordpress.com/2009/07/16/cell-value-from-a-grid/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 09:34:20 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[array function]]></category>
		<category><![CDATA[column()]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[indirect]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[sum]]></category>
		<category><![CDATA[sumproduct]]></category>
		<category><![CDATA[vlookup]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=295</guid>
		<description><![CDATA[While we can use vlookup or hlookup to return a cell value in a particular row or column. Is there a way we can lookup from both row and column to return a particular value from a cell in a grid? Consider the case below: (Yes, I have added more colours to the table this [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=295&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While we can use vlookup or hlookup to return a cell value in a particular row or column. Is there a way we can lookup from both row and column to return a particular value from a cell in a grid?</p>
<p>Consider the case below:</p>
<p><img class="alignnone size-full wp-image-298" title="tip35-cell-in-a-grid" src="http://anupagarwal.files.wordpress.com/2009/07/tip35-cell-in-a-grid1.png?w=429&#038;h=287" alt="tip35-cell-in-a-grid" width="429" height="287" /></p>
<p>(Yes, I have added more colours to the table this time <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<p>The construct is such that every week 5 batches of measurement is carried out. The dates are given in cells A2:A14 and batch numbers are given in cells B1:F1.</p>
<p>Result table for measurement for specific dates and batches is given in the table below:</p>
<p><img class="alignnone size-full wp-image-299" title="tip35-cell-in-a-grid_result" src="http://anupagarwal.files.wordpress.com/2009/07/tip35-cell-in-a-grid_result1.png?w=237&#038;h=121" alt="tip35-cell-in-a-grid_result" width="237" height="121" /></p>
<p>You could use one of the following formulas to arrive at the result:</p>
<p><strong><span style="color:#ff0000;">Method1: vlookup with match</span></strong></p>
<p>C17=<span style="color:#0000ff;">VLOOKUP(A17,A2:F14,MATCH(B17,A1:F1,0),FALSE)</span></p>
<p><span style="color:#000000;">Of course, you could find the same result with hlookup with match. Only remember to lookup in a row instead of a column</span></p>
<p><span style="color:#0000ff;"><strong><span style="color:#ff0000;">Method2: Index with match</span></strong></span></p>
<p>C18=<span style="color:#0000ff;">INDEX(B2:F14,MATCH(A18,A2:A14,0),MATCH(B18,B1:F1,0))</span></p>
<p><span style="color:#ff0000;"><strong>Method3: Indirect with address and match</strong></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">C19</span>=INDIRECT(ADDRESS(MATCH(A19,A2:A14,0)+ROW(A2)-1,MATCH(B19,B1:F1,0)+COLUMN(B1)-1))</span></p>
<p><span style="color:#000000;">And now the bonus formula &#8211; using array</span></p>
<p><span style="color:#0000ff;"><strong><span style="color:#ff0000;">Method4: Sum as an array function</span></strong></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">C20</span> {=SUM(($A$2:$A$14=A20)*($B$1:$F$1=B20)*B2:F14)}</span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">Array formula is entered with</span> <em><span style="color:#0000ff;">ctrl+shift+enter</span></em></span></p>
<p><span style="color:#ff0000;"><strong>Method5: Use sumproduct as an alternate for array function</strong></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">C21</span>=SUMPRODUCT(($A$2:$A$14=A21)*($B$1:$F$1=B21)*B2:F14)</span></p>
<p><span style="color:#000000;">Use one of the above formulas or make one for yourself and share with others. Have fun <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></p>
<br /> Tagged: address, array function, column(), index, indirect, match, row, sum, sumproduct, vlookup <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/295/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/295/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/295/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=295&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/07/16/cell-value-from-a-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip35-cell-in-a-grid1.png" medium="image">
			<media:title type="html">tip35-cell-in-a-grid</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip35-cell-in-a-grid_result1.png" medium="image">
			<media:title type="html">tip35-cell-in-a-grid_result</media:title>
		</media:content>
	</item>
		<item>
		<title>The trick of &#8211;&#8211;</title>
		<link>http://anupagarwal.wordpress.com/2009/07/10/the-trick-of/</link>
		<comments>http://anupagarwal.wordpress.com/2009/07/10/the-trick-of/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 11:59:34 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[trick]]></category>
		<category><![CDATA[--]]></category>
		<category><![CDATA[array formula]]></category>
		<category><![CDATA[isnumber]]></category>
		<category><![CDATA[Left]]></category>
		<category><![CDATA[sum]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=286</guid>
		<description><![CDATA[You read it right. Its going to be a quick post but at the end of it, you would be glad that you read it. Trick1: Text to Number  Consider this =ISNUMBER(LEFT(12345,1)) &#8211; this returns FALSE as this simplifies to =ISNUMBER(&#8220;1&#8243;) However, =ISNUMBER(––LEFT(12345,1)) returns TRUE. The two minus signs in conjunction &#8220;––&#8221; converts text &#8220;1&#8243; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=286&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You read it right. Its going to be a quick post but at the end of it, you would be glad that you read it.</p>
<p><strong><em><span style="color:#ff0000;">Trick1: Text to Number</span></em></strong></p>
<p><strong><em><span style="color:#ff0000;"> </span></em></strong>Consider this<br />
=<span style="color:#0000ff;">ISNUMBER(LEFT(12345,1))</span> &#8211; this returns FALSE as this simplifies to =ISNUMBER(&#8220;1&#8243;)</p>
<p>However, =<span style="color:#0000ff;">ISNUMBER(––LEFT(12345,1))</span> returns TRUE. The two minus signs in conjunction &#8220;––&#8221; converts text &#8220;1&#8243; to number 1</p>
<p>So, also =––&#8221;1&#8243; equals numeric 1</p>
<p><span style="color:#ff0000;"><em><strong>Trick2: Boolean {TRUE, FALSE} to numeric equivalent {1,0}</strong></em></span></p>
<p>Consider,</p>
<p><span style="color:#0000ff;">{=SUM({1,2,3,0,5}&lt;&gt;0)}</span> This is an array formula which reduces to</p>
<p>=SUM({TRUE, TRUE, TRUE, FALSE, TRUE}) and returns a 0</p>
<p>However,</p>
<p><span style="color:#0000ff;">{=SUM(––({1,2,3,0,5}&lt;&gt;0))}</span> correctly puts a 1 for every TRUE and 0 for every FALSE and returns a 4</p>
<p>Check this,</p>
<p>Key in <span style="color:#0000ff;">=(1=1)</span> &#8211; this returns a TRUE</p>
<p>Now <span style="color:#0000ff;">=––(1=1)</span> returns a 1</p>
<p>Before you ask, you will not obtain the same result if you replace –– with +</p>
<p>You may keep this in mind and find a use of it someday <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /> Tagged: --, array formula, isnumber, Left, sum <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/286/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=286&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/07/10/the-trick-of/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>
	</item>
		<item>
		<title>Extracting the nth occurence from an array</title>
		<link>http://anupagarwal.wordpress.com/2009/07/10/extracting-the-nth-occurence-from-an-array/</link>
		<comments>http://anupagarwal.wordpress.com/2009/07/10/extracting-the-nth-occurence-from-an-array/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 09:38:01 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[countif]]></category>
		<category><![CDATA[If]]></category>
		<category><![CDATA[indirect]]></category>
		<category><![CDATA[large]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[sumproduct]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=276</guid>
		<description><![CDATA[In one of the earlier posts, I extracted the first, last, min and max occurence from an array for a particular lookup. Refer this post. The next step perhaps would be to answer if it is possible to extract the second, third occurences and so on. Consequently to extract all occurences for a particular lookup_value. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=276&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In one of the earlier posts, I extracted the first, last, min and max occurence from an array for a particular lookup. Refer <a href="http://anupagarwal.wordpress.com/2009/06/15/first-last-min-max-for-a-particular-value-in-an-array/" target="_blank">this post</a>.</p>
<p>The next step perhaps would be to answer if it is possible to extract the second, third occurences and so on. Consequently to extract all occurences for a particular lookup_value.</p>
<p>Consider the same example, as earlier:</p>
<p><img class="alignnone size-full wp-image-278" title="tip32-1st-last-min-max" src="http://anupagarwal.files.wordpress.com/2009/07/tip32-1st-last-min-max.png?w=200&#038;h=235" alt="tip32-1st-last-min-max" width="200" height="235" /></p>
<p>Each of the 4 persons randomly appear for a test and their scores are recorded. I had given methods to extract the scores for 1st and last attempt by each of the 4 perons. Now lets find out their scores for 2nd, 3rd, etc attempts</p>
<p><img class="alignnone size-full wp-image-279" title="tip34-nth-occurence" src="http://anupagarwal.files.wordpress.com/2009/07/tip34-nth-occurence.png?w=357&#038;h=101" alt="tip34-nth-occurence" width="357" height="101" /></p>
<p>The table above gives the results. Row 1 gives the number of attempt.</p>
<p>The formula used for getting to the result is</p>
<p>F2=<span style="color:#0000ff;">IF(COUNTIF(Person,$E2)&gt;=F$1,INDIRECT(ADDRESS(SUMPRODUCT(LARGE((Person=$E2)*ROW($B$2:$B$15),COUNTIF(Person,$E2)+1-F$1)),3)),&#8221;-&#8221;)</span></p>
<p><span style="color:#000000;">Person is B2:B15</span></p>
<p><span style="color:#000000;">As you would see, I have used sumproduct to avoid using array formula and a combination of indirect and address to extract results.</span></p>
<p><span style="color:#000000;">Here are the steps to understand this formula &#8211; </span></p>
<ul>
<li><span style="color:#000000;">Lets begin with the component </span><span style="color:#0000ff;">LARGE((Person=$E2)*ROW($B$2:$B$15),COUNTIF(Person,$E2)+1-F$1</span></li>
<li><span style="color:#000000;">Remember Large function has the syntax <span style="color:#ff6600;">LARGE(array,k) <span style="color:#000000;">which returns the kth largest value from the array. For example if k=2, then the function returns second largest value in the array.</span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;">Now, (Person=$E2)*ROW($B$2:$B$15) would create an array like {0,2,0,0,5,0,0,0,9,0,0,0,0,0,0} which is essentially the row numbers of cells in the array where Person=Mike is true</span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;">For the k part in large function, I have entered <span style="color:#0000ff;">COUNTIF(Person,$E2)+1-F$1<span style="color:#000000;">. Mike occurs 3 times in array Person, so the k would be 3,2,1, such that 1st attempt score is followed by 2nd attempt score and so on</span></span></span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Once this is clear, rest is easy</span></span></span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Address function has syntax Address(row_num, column_num, [abs_num]). row_num is given from the large function, column_num is entered as 3, which is the column number of Score, [abs_num] is omitted which returns address in absolute eg $C$2</span></span></span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Indirect(&#8220;$C$2&#8243;) returns the value inC2.</span></span></span></span></span></li>
<li><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">If condition at the beginning simply evaluates if we have exhausted all occurences of Mike. Once done, it returns a &#8220;-&#8221;.</span></span></span></span></span></li>
</ul>
<p><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><em><strong>§ Note: This also is a better way for </strong></em><a href="http://anupagarwal.wordpress.com/2009/05/04/multiple-extraction-through-vlookup/" target="_blank"><em><strong>multiple extraction </strong></em></a><em><strong>because sorting of original table is not required.</strong></em> </span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">There are 3 other alternative formulas given in the <a href="http://anupagarwal.wordpress.com/2009/06/15/first-last-min-max-for-a-particular-value-in-an-array/" target="_blank">earlier post </a>to achieve the same result.</span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#ff6600;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Else, if one method is sufficient for you, use this and have fun <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></span></span></span></span></p>
<br /> Tagged: address, countif, If, indirect, large, row, sumproduct <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=276&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/07/10/extracting-the-nth-occurence-from-an-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip32-1st-last-min-max.png" medium="image">
			<media:title type="html">tip32-1st-last-min-max</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip34-nth-occurence.png" medium="image">
			<media:title type="html">tip34-nth-occurence</media:title>
		</media:content>
	</item>
		<item>
		<title>Sum &#8211; Year to Date</title>
		<link>http://anupagarwal.wordpress.com/2009/07/06/sum-year-to-date/</link>
		<comments>http://anupagarwal.wordpress.com/2009/07/06/sum-year-to-date/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 11:56:49 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[offset]]></category>
		<category><![CDATA[sum]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=261</guid>
		<description><![CDATA[The problem here is summing sales figure from the start of the year to a particular month Sales of 2 products (Item1 and Item2) is given for an entire year &#8211; Jan to Dec. The objective is to find cummulative sales till a particular month. For instance the input is Item1 and Jun &#8211; where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=261&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The problem here is summing sales figure from the start of the year to a particular month</p>
<p><img class="alignnone size-full wp-image-262" title="tip33-sumYTD" src="http://anupagarwal.files.wordpress.com/2009/07/tip33-sumytd.png?w=450&#038;h=49" alt="tip33-sumYTD" width="450" height="49" /></p>
<p>Sales of 2 products (Item1 and Item2) is given for an entire year &#8211; Jan to Dec. The objective is to find cummulative sales till a particular month. For instance the input is Item1 and Jun &#8211; where the output should be sum of sales of Item1 from Jan to Jun (highlighted in yellow).</p>
<p><img class="alignnone size-full wp-image-264" title="tip33-sumYTD-solution" src="http://anupagarwal.files.wordpress.com/2009/07/tip33-sumytd-solution1.png?w=149&#038;h=61" alt="tip33-sumYTD-solution" width="149" height="61" /></p>
<p>The desired result is given in the table above. I have used offset function to obtain the result. The function is used with multiple width.</p>
<p>The formula used in C6 is <span style="color:#0000ff;">=SUM(OFFSET($A$1,MATCH(B6,$A$2:$A$3,0),1,1,MATCH(A6,$B$1:$M$1,0)))</span></p>
<p><span style="color:#000000;">The first match function returns 1, which is number of rows to offset from the reference A1, the second match function returns 6 &#8211; position of month Jun in Jan to Dec &#8211; which equals the width of column to sum i.e. Jan to Jun.</span></p>
<p><span style="color:#000000;">Note that this is entered as a simple formula and not an array formula.</span></p>
<p><span style="color:#000000;">The formula can be dragged down to obtain result in C7 -  which is summation of sales of Item2 for YTD Mar.</span></p>
<p><span style="color:#000000;">Thanks Bret for highlighting this problem.</span></p>
<p><span style="color:#000000;">Have fun <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></p>
<p><span style="color:#000000;"> </span></p>
<br /> Tagged: match, offset, sum <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/261/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/261/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/261/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=261&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/07/06/sum-year-to-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip33-sumytd.png" medium="image">
			<media:title type="html">tip33-sumYTD</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/07/tip33-sumytd-solution1.png" medium="image">
			<media:title type="html">tip33-sumYTD-solution</media:title>
		</media:content>
	</item>
		<item>
		<title>First, Last, Min, Max for a particular value in an array</title>
		<link>http://anupagarwal.wordpress.com/2009/06/15/first-last-min-max-for-a-particular-value-in-an-array/</link>
		<comments>http://anupagarwal.wordpress.com/2009/06/15/first-last-min-max-for-a-particular-value-in-an-array/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 09:13:53 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[If]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[indirect]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[min]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[sumproduct]]></category>
		<category><![CDATA[vlookup]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=251</guid>
		<description><![CDATA[Consider a set-up where 4 users randomly appear for a test. Their scores are recorded in the order in which they appear for the test. Our objective is to find their scores in the first and last attempts and also their minimum and maximum scores. Here are the users and their scores: The objective is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=251&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider a set-up where 4 users randomly appear for a test. Their scores are recorded in the order in which they appear for the test. Our objective is to find their scores in the first and last attempts and also their minimum and maximum scores. Here are the users and their scores:<br />
<img class="alignnone size-full wp-image-252" title="tip32-1st-last-min-max" src="http://anupagarwal.files.wordpress.com/2009/06/tip32-1st-last-min-max.png?w=222&#038;h=261" alt="tip32-1st-last-min-max" width="222" height="261" /></p>
<p>The objective is to find the first, last, min and max score for each user. The solution looks like this:</p>
<p><img class="alignnone size-full wp-image-253" title="tip32-solution" src="http://anupagarwal.files.wordpress.com/2009/06/tip32-solution.png?w=347&#038;h=100" alt="tip32-solution" width="347" height="100" /></p>
<p>For <span style="text-decoration:underline;">first attempt</span> score, the formula is a simple vlookup</p>
<p>F2=<span style="color:#0000ff;">VLOOKUP(E2,$B$2:$C$15,2,FALSE)</span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;">Person</span> is B2:B15 and <span style="color:#0000ff;">Score</span> is C2:C15</span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">For <span style="text-decoration:underline;">max score</span>, the formula is simply:</span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">H2 <span style="color:#0000ff;">{=MAX(IF(Person=E2,Score,0))} <span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Similarly, for min score, the formula is</span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">I2 <span style="color:#0000ff;">{=MIN(IF(Person=E2,Score,100))} <span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">I have entered 100 as it is greater than the largest number in<span style="color:#0000ff;"> Score. <span style="color:#000000;">You may replace this with max(<span style="color:#0000ff;">Score</span>)+1. </span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;">Now for <span style="text-decoration:underline;">last attempt</span> score, you could use one of the 3 sets of formulas</span></p>
<p><span style="color:#000000;">1. Using Index function &#8211; array formula</span></p>
<p><span style="color:#000000;">G2 <span style="color:#0000ff;">{=INDEX(Score,MAX((Person=E2)*ROW(Person))-ROW(Person)+1)} <span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">In this formula, max function finds out the last row number for a particular user. For instance for user Andy, <span style="color:#0000ff;">MAX((Person=E2)*ROW(Person)) <span style="color:#000000;">returns 14. To return the score for Andy in the last attempt, I have used index function. The minus part of <span style="color:#0000ff;">ROW(Person)+1 <span style="color:#000000;">simply takes care of cells above array<span style="color:#0000ff;"> Score.</span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">2. Indirect-address function &#8211; array formula</span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;">G2 {=INDIRECT(ADDRESS(MAX((Person=E2)*ROW(Person)),3))} <span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><em><span style="color:#000000;">If you feel uncomfortable with entering a number in the formula, you could replace 3 with column(<span style="color:#0000ff;">Score</span>)</span></em></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">3. Index &#8211; Sumproduct function</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">If you are tired of using array formulas, sumproduct offers some respite</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">G2=<span style="color:#0000ff;">INDEX(Score,SUMPRODUCT(MAX((Person=E2)*ROW(Person)))-ROW(Person)+1)</span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">The formula is similar to the Index with array formula. Here sumproduct is used differently then the normal usage. Notice that there is only one array in sumproduct. The function treats the parameters entered as an array, so we need not enter it as an array formula.</span></span></span></span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Similarly, indirect address formula can also be entered with sumproduct without entering it as an array formula.</span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Give it a try. Have fun <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Answer:</span></span></span></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><img class="alignnone size-full wp-image-254" title="tip32-quiz" src="http://anupagarwal.files.wordpress.com/2009/06/tip32-quiz.png?w=500&#038;h=28" alt="tip32-quiz" width="500" height="28" /></span></span></span></span></span></span></span></span></span></p>
<br /> Tagged: address, If, index, indirect, max, min, row, sumproduct, vlookup <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/251/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/251/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/251/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=251&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/06/15/first-last-min-max-for-a-particular-value-in-an-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip32-1st-last-min-max.png" medium="image">
			<media:title type="html">tip32-1st-last-min-max</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip32-solution.png" medium="image">
			<media:title type="html">tip32-solution</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip32-quiz.png" medium="image">
			<media:title type="html">tip32-quiz</media:title>
		</media:content>
	</item>
		<item>
		<title>DPD analysis using two condition sum</title>
		<link>http://anupagarwal.wordpress.com/2009/06/10/dpd-analysis-using-two-condition-sum/</link>
		<comments>http://anupagarwal.wordpress.com/2009/06/10/dpd-analysis-using-two-condition-sum/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 13:11:00 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[array formula]]></category>
		<category><![CDATA[frequency]]></category>
		<category><![CDATA[If]]></category>
		<category><![CDATA[sum]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=244</guid>
		<description><![CDATA[Days past due analysis, two condition sum, bucketing data, frequency function Here I have carried out a days past due (DPD) analysis. This requires organizing data in various days bucket and makes use of conditional sum function. 14 cases are presented. Each case has a days past due and a corresponding amount. The objective is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=244&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><em>Days past due analysis, two condition sum, bucketing data, frequency function</em></span></p>
<p>Here I have carried out a days past due (DPD) analysis. This requires organizing data in various days bucket and makes use of conditional sum function.<br />
<img class="alignnone size-full wp-image-243" title="tip31-conditional-sum" src="http://anupagarwal.files.wordpress.com/2009/06/tip31-conditional-sum.png?w=252&#038;h=273" alt="tip31-conditional-sum" width="252" height="273" /></p>
<p>14 cases are presented. Each case has a days past due and a corresponding amount. The objective is to put these numbers in various previously identified buckets</p>
<p><img class="alignnone size-full wp-image-246" title="tip31-conditional-sum-result" src="http://anupagarwal.files.wordpress.com/2009/06/tip31-conditional-sum-result1.png?w=393&#038;h=210" alt="tip31-conditional-sum-result" width="393" height="210" /></p>
<p>The days past due is defined as (0,1] which means 0&lt;DPD&lt;=1 and so on. This is re-written as in column F.</p>
<p>To calculate the amount in column G the following formulas are used, where <span style="color:#0000ff;">DPD</span> is the array B2:B15</p>
<p>G2 <span style="color:#0000ff;">{=SUM(IF((DPD&gt;0)*(DPD&lt;=$F2),C$2:C$15,0))}</span></p>
<p>G3 <span style="color:#0000ff;">{=SUM(IF((DPD&gt;$F2)*(DPD&lt;=$F3),C$2:C$15,0))}</span> which can then be dragged till end of column</p>
<p>Both entered as array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></p>
<p><span style="color:#000000;">To count occurences in each DPD bucket the following formulas are used</span></p>
<p><span style="color:#000000;">H2 <span style="color:#0000ff;">{=SUM(IF((DPD&gt;0)*(DPD&lt;=$F2),1,0))}</span></span></p>
<p><span style="color:#000000;">H3 <span style="color:#0000ff;">{=SUM(IF((DPD&gt;$F2)*(DPD&lt;=$F3),1,0))} <span style="color:#000000;">which can then be dragged to end of column</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">You could also use the frequency function for counting occurences</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Enter formula in I2 <span style="color:#0000ff;">=FREQUENCY(DPD,F2:F11)</span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Select I2 to I11, press F2 followed by<span style="color:#0000ff;"><span style="color:#000000;"> <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></span></span></p>
<p><span style="color:#000000;">Note that the two conditions entered for summing is akin to using SUMIF with criteria as AND(cond1, cond2). However, AND criteria does not work with SUMIF. </span></p>
<p><span style="color:#000000;">Also one could use nested if to achieve the same result. The above format simplifies nested if through using the following logic</span></p>
<p><span style="color:#000000;">TRUE*TRUE=TRUE</span></p>
<p><span style="color:#000000;">All other permutations give a FALSE result, which is exactly a two condition AND criteria.</span></p>
<p><span style="color:#000000;">Have fun figuring this out <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </span></p>
<br /> Tagged: array formula, frequency, If, sum <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=244&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/06/10/dpd-analysis-using-two-condition-sum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip31-conditional-sum.png" medium="image">
			<media:title type="html">tip31-conditional-sum</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip31-conditional-sum-result1.png" medium="image">
			<media:title type="html">tip31-conditional-sum-result</media:title>
		</media:content>
	</item>
		<item>
		<title>Lookup_value as array</title>
		<link>http://anupagarwal.wordpress.com/2009/06/09/lookup_value-as-array/</link>
		<comments>http://anupagarwal.wordpress.com/2009/06/09/lookup_value-as-array/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 08:11:14 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Tip]]></category>
		<category><![CDATA[array formula]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[sum]]></category>
		<category><![CDATA[vlookup]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=236</guid>
		<description><![CDATA[lookup_value as array, why lookup over vlookup, multiple lookup_value in single lookup function, sum(lookup) In one of my earlier posts, I had illustrated passing an array for col_index_num in vlookup. Refer Extract and sum vlookup results. We now look at the possibility of passing an array for lookup_value in vlookup. Refer the example below: If we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=236&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><em>lookup_value as array, why lookup over vlookup, multiple lookup_value in single lookup function, sum(lookup)</em></span></p>
<p>In one of my earlier posts, I had illustrated passing an array for col_index_num in vlookup. Refer <a href="http://anupagarwal.wordpress.com/2009/06/01/extract-and-sum-vlookup-results/">Extract and sum vlookup results</a>.</p>
<p>We now look at the possibility of passing an array for lookup_value in vlookup. Refer the example below:</p>
<p><img class="alignnone size-full wp-image-237" title="tip30-sum_mult_lookup_value" src="http://anupagarwal.files.wordpress.com/2009/06/tip30-sum_mult_lookup_value.png?w=305&#038;h=136" alt="tip30-sum_mult_lookup_value" width="305" height="136" /></p>
<p>If we were required to sum the sale of Prod3 for Angie, Mike and Ross (cells highlighted in yellow), can we do it through a single vlookup function. Lets say an array is defined as {Ross, Mike, Angie} as <span style="color:#0000ff;">salesperson.</span></p>
<p><span style="color:#000000;">This vlookup function</span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;">{=SUM(VLOOKUP(salesperson,A3:D7,4,FALSE))}</span> entered as an array with <span style="color:#0000ff;"><em>ctrl+shift+enter </em></span>gives the result as 3 &#8211; which corresponds to sale of Prod3 by Ross (first element in the array <span style="color:#0000ff;">salesperson</span>). So clearly the array function is not working!</span></p>
<p><span style="color:#000000;">Lets now try the lookup function. Revise the above formula as</span></p>
<p><span style="color:#0000ff;">{=SUM(LOOKUP(salesperson,A3:D7))} </span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">OR</span></span></p>
<p><span style="color:#0000ff;"><span style="color:#0000ff;">{=SUM(LOOKUP(salesperson,A3:A7,D3:D7))}</span></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">which depends on your comfort with the two syntax for lookup</span></span></p>
<ul>
<li><span style="color:#0000ff;"><span style="color:#000000;">LOOKUP(lookup_value,array)</span></span></li>
<li><span style="color:#0000ff;"><span style="color:#000000;">LOOKUP(lookup_value,lookup_vector,result_vector)</span></span></li>
</ul>
<p><span style="color:#0000ff;"><span style="color:#000000;">entered as an array formula with <em><span style="color:#0000ff;">ctrl+shift+enter</span></em></span></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">The formula works and it correctly returns 114</span></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">The point to notice here is that lookup_array needs to be in ascending order.</span></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">Have fun. This is only the second time that I have used lookup function. It also explains why in the previous post &#8211; <a href="http://anupagarwal.wordpress.com/2009/06/08/text-to-numbers/" target="_blank">Text to numbers</a> - method 2, I have used lookup and not vlookup.</span></span></p>
<p><span style="color:#0000ff;"><span style="color:#000000;">Have fun <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></span></p>
<br /> Tagged: array formula, lookup, sum, vlookup <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/236/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/236/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/236/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=236&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/06/09/lookup_value-as-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip30-sum_mult_lookup_value.png" medium="image">
			<media:title type="html">tip30-sum_mult_lookup_value</media:title>
		</media:content>
	</item>
		<item>
		<title>Text to Numbers</title>
		<link>http://anupagarwal.wordpress.com/2009/06/08/text-to-numbers/</link>
		<comments>http://anupagarwal.wordpress.com/2009/06/08/text-to-numbers/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 06:07:17 +0000</pubDate>
		<dc:creator>anupagarwal</dc:creator>
				<category><![CDATA[Just Like That]]></category>
		<category><![CDATA[array formula]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[indirect]]></category>
		<category><![CDATA[Len]]></category>
		<category><![CDATA[lookup]]></category>
		<category><![CDATA[lower]]></category>
		<category><![CDATA[mid]]></category>
		<category><![CDATA[row]]></category>
		<category><![CDATA[Substitute]]></category>
		<category><![CDATA[sum]]></category>

		<guid isPermaLink="false">http://anupagarwal.wordpress.com/?p=230</guid>
		<description><![CDATA[Just like that, each alphabet corresponds to a number, summing up alphabets I cant really see how this post could be useful to you. One of my friends who believed in numerology brought this problem to me of converting names to numbers. Here is the solution that we worked out. You may treat this as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=230&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff9900;"><em><span style="color:#ff6600;">Just like that, each alphabet corresponds to a number, summing up alphabets</span></em></span></p>
<p><span style="color:#000000;">I cant really see how this post could be useful to you. One of my friends who believed in numerology brought this problem to me of converting names to numbers. Here is the solution that we worked out. You may treat this as a <span style="color:#ff6600;"><em>Just Like That</em></span> entry until it finds any use.</span></p>
<p><span style="color:#000000;">Lets say the names are stored in column A, have worked out a numerical equivalent in column B using the equivalence (A or a =1) and (Z or z = 26) with all other alphabets in between</span></p>
<p><span style="color:#000000;"><img class="alignnone size-full wp-image-231" title="tip29-text_to_numbers" src="http://anupagarwal.files.wordpress.com/2009/06/tip29-text_to_numbers.png?w=276&#038;h=85" alt="tip29-text_to_numbers" width="276" height="85" /></span></p>
<p><span style="color:#000000;"><span style="text-decoration:underline;">Method 1: Using <span style="color:#0000ff;">CODE</span> function</span></span></p>
<p><span style="color:#000000;">For windows CODE(text) returns the ANSI code of the first character in the text string.</span></p>
<ul>
<li><span style="color:#000000;">code(&#8220;A&#8221;)=65 and code(&#8220;Z&#8221;)=90 with all other upper case alphabets in between</span></li>
<li><span style="color:#000000;">code(&#8220;a&#8221;)=97 and code(&#8220;z&#8221;)=122 with all other lower case alphabets in between</span></li>
</ul>
<p><span style="color:#000000;">The formula in B2 <span style="color:#0000ff;">{=SUM(CODE(MID(LOWER(A2),ROW(INDIRECT(&#8220;1:&#8221;&amp;LEN(A2))),1))-96)} </span></span></p>
<p><span style="color:#000000;">entered as an array formula with <em><span style="color:#0000ff;">ctrl+shift+enter</span></em></span></p>
<p><span style="color:#000000;">Here <span style="color:#0000ff;">lower <span style="color:#000000;">function is used so that all alphabets are treated as lower case and ansi code is from 97 to 122</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Hence, 96 is subtracted so that <em>a </em>has numerical equivalent of 1</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Cell A4 (Anup Agarwal) has space between the first name and last name. We can use substitute function to replace the space with no space. The revised formula in cell B4 is</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">B4 <span style="color:#0000ff;">{=SUM(CODE(MID(LOWER(SUBSTITUTE(A4,&#8221; &#8220;,&#8221;")),ROW(INDIRECT(&#8220;1:&#8221;&amp;LEN(SUBSTITUTE(A4,&#8221; &#8220;,&#8221;")))),1))-96)}</span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">again entered as an array formula with</span> <em>ctrl+shift+enter</em></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="text-decoration:underline;">Method 2: Using <span style="color:#0000ff;">lookup</span> function</span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">You can avoid using CODE function and use the lookup function to achieve the same result. Have defined the following table as equivalent</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><img class="alignleft size-full wp-image-232" title="tip29-text_to_numbers_equivalent" src="http://anupagarwal.files.wordpress.com/2009/06/tip29-text_to_numbers_equivalent.png?w=37&#038;h=399" alt="tip29-text_to_numbers_equivalent" width="37" height="399" /></span></span></span></p>
<p><span style="color:#000000;"> </span></p>
<p><span style="color:#000000;">The formula entered in B2  <span style="color:#0000ff;">{=SUM(LOOKUP(MID(A2,ROW(INDIRECT(&#8220;1:&#8221;&amp;LEN(A2))),1),equivalent))} </span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">The formula entered in B4 is</span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;">{=SUM(LOOKUP(MID(SUBSTITUTE(A4,&#8221; &#8220;,&#8221;"),ROW(INDIRECT(&#8220;1:&#8221;&amp;LEN(SUBSTITUTE(A4,&#8221; &#8220;,&#8221;")))),1),equivalent))}</span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">entered as an array formula with <span style="color:#0000ff;"><em>ctrl+shift+enter</em></span></span></span></span></span></span></p>
<p><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;"><span style="color:#0000ff;"><span style="color:#000000;">Have fun and let me know if you ever find use of it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></span></span></span></span></span></span></p>
<br /> Tagged: array formula, code, indirect, Len, lookup, lower, mid, row, Substitute, sum <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/anupagarwal.wordpress.com/230/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/anupagarwal.wordpress.com/230/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/anupagarwal.wordpress.com/230/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=anupagarwal.wordpress.com&amp;blog=7654102&amp;post=230&amp;subd=anupagarwal&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://anupagarwal.wordpress.com/2009/06/08/text-to-numbers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/577212f3185326e69fa925dc07617bb1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Anup</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip29-text_to_numbers.png" medium="image">
			<media:title type="html">tip29-text_to_numbers</media:title>
		</media:content>

		<media:content url="http://anupagarwal.files.wordpress.com/2009/06/tip29-text_to_numbers_equivalent.png" medium="image">
			<media:title type="html">tip29-text_to_numbers_equivalent</media:title>
		</media:content>
	</item>
	</channel>
</rss>
