<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Summing the Digits of a Number</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 08 Feb 2012 23:58:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42157</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Mon, 16 Nov 2009 17:30:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42157</guid>
		<description>&lt;p&gt;I wrote my original function more as an interesting case because it was a one-liner solution. If you want to go to multiple lines and, especially, a loop solution, then I would use the code Charles Williams posted earlier... the Byte array method would be among the fastest possible loop solutions that could be constructed.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I wrote my original function more as an interesting case because it was a one-liner solution. If you want to go to multiple lines and, especially, a loop solution, then I would use the code Charles Williams posted earlier&#8230; the Byte array method would be among the fastest possible loop solutions that could be constructed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hans schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42156</link>
		<dc:creator>hans schraven</dc:creator>
		<pubDate>Mon, 16 Nov 2009 17:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42156</guid>
		<description>&lt;p&gt;Rick,&lt;/p&gt;
&lt;p&gt;to avoid limits and &#039;impossible&#039; tests:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; SumDigits2(S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160;c1 = Replace(&lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;(29, &lt;span class=&quot;st0&quot;&gt;&quot;+&quot;&lt;/span&gt;), &lt;span class=&quot;st0&quot;&gt;&quot;+&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;+0&quot;&lt;/span&gt;)&lt;br&gt;
&#160;&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; j = 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; Len(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;)) &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; 29&lt;br&gt;
&#160; &#160;SumDigits2 = SumDigits2 + Evaluate(Format(Mid(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;), j, 29), c1))&lt;br&gt;
&#160;&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Rick,</p>
<p>to avoid limits and &#8216;impossible&#8217; tests:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> SumDigits2(S <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp;c1 = Replace(<span class="kw1">String</span>(29, <span class="st0">&#8220;+&#8221;</span>), <span class="st0">&#8220;+&#8221;</span>, <span class="st0">&#8220;+0&#8243;</span>)<br />
&nbsp;<span class="kw1">For</span> j = 1 <span class="kw1">To</span> Len(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>)) <span class="kw1">Step</span> 29<br />
&nbsp; &nbsp;SumDigits2 = SumDigits2 + Evaluate(Format(Mid(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>), j, 29), c1))<br />
&nbsp;<span class="kw1">Next</span><br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42155</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Mon, 16 Nov 2009 16:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42155</guid>
		<description>&lt;p&gt;What! I did it again!! Okay, I changed the test so that I can&#039;t screw it up again ;-)&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; SumDigits2(S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Len(S) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; SumDigits2 = Evaluate(Format(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;), Replace(&lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;(29, &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;), &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;+0&quot;&lt;/span&gt;)))&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>What! I did it again!! Okay, I changed the test so that I can&#8217;t screw it up again <img src='http://www.dailydoseofexcel.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> SumDigits2(S <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; <span class="kw1">If</span> Len(S) <span class="kw1">Then</span> SumDigits2 = Evaluate(Format(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>), Replace(<span class="kw1">String</span>(29, <span class="st0">&#8220;x&#8221;</span>), <span class="st0">&#8220;x&#8221;</span>, <span class="st0">&#8220;+0&#8243;</span>)))<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42154</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Mon, 16 Nov 2009 16:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42154</guid>
		<description>&lt;p&gt;Arrgh! I did it again... I forgot about the &quot;not equal&quot; sign problem...&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; SumDigits2(S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; S &#160;&lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; SumDigits2 = Evaluate(Format(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;), Replace(&lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;(29, &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;), &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;+0&quot;&lt;/span&gt;)))&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Arrgh! I did it again&#8230; I forgot about the &#8220;not equal&#8221; sign problem&#8230;</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> SumDigits2(S <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; <span class="kw1">If</span> S &nbsp;<span class="st0">&#8220;&#8221;</span> <span class="kw1">Then</span> SumDigits2 = Evaluate(Format(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>), Replace(<span class="kw1">String</span>(29, <span class="st0">&#8220;x&#8221;</span>), <span class="st0">&#8220;x&#8221;</span>, <span class="st0">&#8220;+0&#8243;</span>)))<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42153</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Mon, 16 Nov 2009 16:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42153</guid>
		<description>&lt;p&gt;Hans,&lt;/p&gt;
&lt;p&gt;Your function will not be able to handle more than 29 total (text) digits because of a limitation in the Format function... it appears to use the Decimal sub-type of the Variant data type to process its first argument and the Decimal sub-type is limited to a maximum of 29 digits total digits providing there is no decimal point (which is the reason for the first Replace function call). For example, try this macro out with your function and you will see the problem (displayed in the Immediate Window)...&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; test()&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; X &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, TestNumber &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; X = 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 3&lt;br&gt;
&#160; &#160; TestNumber = &lt;span class=&quot;st0&quot;&gt;&quot;123456789012345678901234567&quot;&lt;/span&gt; &amp; Mid(&lt;span class=&quot;st0&quot;&gt;&quot;890&quot;&lt;/span&gt;, 1, X)&lt;br&gt;
&#160; &#160; Debug.&lt;span class=&quot;kw1&quot;&gt;Print&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;Sum &quot;&lt;/span&gt; &amp; TestNumber &amp; &lt;span class=&quot;st0&quot;&gt;&quot; digits is &quot;&lt;/span&gt; &amp; SumDigits2(TestNumber)&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The first two digit sums will be correct but the third one (where only a zero is being affixed to the end of the second one) will be obviously incorrect. However, I do note your elimination of the concatenation of the leading zero in favor of including it inside the second Replace function call is a good way to simplify the function further...&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; SumDigits2(S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; S &#160;&lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; SumDigits2 = Evaluate(Format(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;), Replace(&lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;(29, &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;), &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;+0&quot;&lt;/span&gt;)))&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<p>Hans,</p>
<p>Your function will not be able to handle more than 29 total (text) digits because of a limitation in the Format function&#8230; it appears to use the Decimal sub-type of the Variant data type to process its first argument and the Decimal sub-type is limited to a maximum of 29 digits total digits providing there is no decimal point (which is the reason for the first Replace function call). For example, try this macro out with your function and you will see the problem (displayed in the Immediate Window)&#8230;</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> test()<br />
&nbsp; <span class="kw1">Dim</span> X <span class="kw1">As</span> <span class="kw1">Long</span>, TestNumber <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; <span class="kw1">For</span> X = 1 <span class="kw1">To</span> 3<br />
&nbsp; &nbsp; TestNumber = <span class="st0">&#8220;123456789012345678901234567&#8243;</span> &amp;amp; Mid(<span class="st0">&#8220;890&#8243;</span>, 1, X)<br />
&nbsp; &nbsp; Debug.<span class="kw1">Print</span> <span class="st0">&#8220;Sum &#8220;</span> &amp;amp; TestNumber &amp;amp; <span class="st0">&#8221; digits is &#8220;</span> &amp;amp; SumDigits2(TestNumber)<br />
&nbsp; <span class="kw1">Next</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p>The first two digit sums will be correct but the third one (where only a zero is being affixed to the end of the second one) will be obviously incorrect. However, I do note your elimination of the concatenation of the leading zero in favor of including it inside the second Replace function call is a good way to simplify the function further&#8230;</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> SumDigits2(S <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; <span class="kw1">If</span> S &nbsp;<span class="st0">&#8220;&#8221;</span> <span class="kw1">Then</span> SumDigits2 = Evaluate(Format(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>), Replace(<span class="kw1">String</span>(29, <span class="st0">&#8220;x&#8221;</span>), <span class="st0">&#8220;x&#8221;</span>, <span class="st0">&#8220;+0&#8243;</span>)))<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: hans schraven</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42148</link>
		<dc:creator>hans schraven</dc:creator>
		<pubDate>Mon, 16 Nov 2009 12:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42148</guid>
		<description>&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; SumDigits2(S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Variant&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; S NEQ &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; SumDigits2 = Evaluate(Format(Replace(S, &lt;span class=&quot;st0&quot;&gt;&quot;.&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;), Replace(&lt;span class=&quot;kw1&quot;&gt;string&lt;/span&gt;(len(s),&lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;), &lt;span class=&quot;st0&quot;&gt;&quot;x&quot;&lt;/span&gt;, &lt;span class=&quot;st0&quot;&gt;&quot;+0&quot;&lt;/span&gt;)))&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
</description>
		<content:encoded><![CDATA[<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Function</span> SumDigits2(S <span class="kw1">As</span> <span class="kw1">Variant</span>) <span class="kw1">As</span> <span class="kw1">Long</span><br />
<span class="kw1">If</span> S NEQ <span class="st0">&#8220;&#8221;</span> <span class="kw1">Then</span> SumDigits2 = Evaluate(Format(Replace(S, <span class="st0">&#8220;.&#8221;</span>, <span class="st0">&#8220;&#8221;</span>), Replace(<span class="kw1">string</span>(len(s),<span class="st0">&#8220;x&#8221;</span>), <span class="st0">&#8220;x&#8221;</span>, <span class="st0">&#8220;+0&#8243;</span>)))<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42130</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Sun, 15 Nov 2009 22:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42130</guid>
		<description>&lt;p&gt;Let&#039;s try that formula again, this time using .ne. in place of the &quot;not equal&quot; sign (less than symbol followed by greater than symbol) that the Comment Processor &quot;ate&quot; (so if copy/pasting this, make the substition back to the &quot;not equal&quot; sign)...&lt;/p&gt;
&lt;p&gt;Function SumDigits2(S As Variant) As Long&lt;br&gt;
  If S .ne. &quot;&quot; Then SumDigits2 = Evaluate(Format(Replace(S, &quot;.&quot;, &quot;&quot;), &quot;0? &amp; Replace(String(28, &quot;x&quot;), &quot;x&quot;, &quot;+0?)))&lt;br&gt;
End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Let&#8217;s try that formula again, this time using .ne. in place of the &#8220;not equal&#8221; sign (less than symbol followed by greater than symbol) that the Comment Processor &#8220;ate&#8221; (so if copy/pasting this, make the substition back to the &#8220;not equal&#8221; sign)&#8230;</p>
<p>Function SumDigits2(S As Variant) As Long<br />
  If S .ne. &#8220;&#8221; Then SumDigits2 = Evaluate(Format(Replace(S, &#8220;.&#8221;, &#8220;&#8221;), &#8220;0? &amp; Replace(String(28, &#8220;x&#8221;), &#8220;x&#8221;, &#8220;+0?)))<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-42129</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Sun, 15 Nov 2009 22:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-42129</guid>
		<description>&lt;p&gt;If you are willing to accept an error being generated if a cell does not contain a real number (whether as text or as an actual number), 12AB34 as an example, and if you textual numbers are no more than 29 significant digits long, then this one-liner UDF should work...&lt;/p&gt;
&lt;p&gt;Function SumDigits2(S As Variant) As Long&lt;br&gt;
  If S  &quot;&quot; Then SumDigits2 = Evaluate(Format(Replace(S, &quot;.&quot;, &quot;&quot;), &quot;0? &amp; Replace(String(28, &quot;x&quot;), &quot;x&quot;, &quot;+0?)))&lt;br&gt;
End Function&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>If you are willing to accept an error being generated if a cell does not contain a real number (whether as text or as an actual number), 12AB34 as an example, and if you textual numbers are no more than 29 significant digits long, then this one-liner UDF should work&#8230;</p>
<p>Function SumDigits2(S As Variant) As Long<br />
  If S  &#8220;&#8221; Then SumDigits2 = Evaluate(Format(Replace(S, &#8220;.&#8221;, &#8220;&#8221;), &#8220;0? &amp; Replace(String(28, &#8220;x&#8221;), &#8220;x&#8221;, &#8220;+0?)))<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tushar Mehta</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-41583</link>
		<dc:creator>Tushar Mehta</dc:creator>
		<pubDate>Sat, 10 Oct 2009 18:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-41583</guid>
		<description>&lt;p&gt;Lori: That&#039;s slick.  It works with positive and negative numbers, with an empty cell, and with decimal numbers.  It evens adds the numbers in a string that contains non-numeric characters.  Of course, whether that&#039;s good or bad is not clear...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Lori: That&#8217;s slick.  It works with positive and negative numbers, with an empty cell, and with decimal numbers.  It evens adds the numbers in a string that contains non-numeric characters.  Of course, whether that&#8217;s good or bad is not clear&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lori</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/10/03/summing-the-digits-of-a-number/#comment-41482</link>
		<dc:creator>Lori</dc:creator>
		<pubDate>Mon, 05 Oct 2009 14:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3047#comment-41482</guid>
		<description>&lt;p&gt;one more: =SUM(LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9,&quot;&quot;},&quot;&quot;))*-{1,2,3,4,5,6,7,8,9,-45})&lt;/p&gt;
&lt;p&gt;don&#039;t know how it compares in speed, but is efficient in that it doesn&#039;t depend on other ranges so only recalculates when A1 changes. lhm&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>one more: =SUM(LEN(SUBSTITUTE(A1,{1,2,3,4,5,6,7,8,9,&#8221;"},&#8221;"))*-{1,2,3,4,5,6,7,8,9,-45})</p>
<p>don&#8217;t know how it compares in speed, but is efficient in that it doesn&#8217;t depend on other ranges so only recalculates when A1 changes. lhm</p>
]]></content:encoded>
	</item>
</channel>
</rss>

