<?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: Find Position of First Capital Letter in a String</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 23:42:03 +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/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66652</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Fri, 30 Sep 2011 20:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66652</guid>
		<description>&lt;p&gt;You are quite welcome... I&#039;m glad you got it to work for you. I am pretty sure it does everything you mentioned you wanted in your earlier response to Dick, but if I missed anything, or if you want something additional, please feel free to ask. You can do that here at this forum or you can email me directly at rickDOTnewsATverizonDOTnet (replace the upper case letters with the symbol they spell out).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You are quite welcome&#8230; I&#8217;m glad you got it to work for you. I am pretty sure it does everything you mentioned you wanted in your earlier response to Dick, but if I missed anything, or if you want something additional, please feel free to ask. You can do that here at this forum or you can email me directly at rickDOTnewsATverizonDOTnet (replace the upper case letters with the symbol they spell out).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66639</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Fri, 30 Sep 2011 08:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66639</guid>
		<description>&lt;p&gt;@Rick&lt;/p&gt;
&lt;p&gt;Not sure what was going on but tried it in a fresh document and worked like a treat. Thanks Heaps!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Rick</p>
<p>Not sure what was going on but tried it in a fresh document and worked like a treat. Thanks Heaps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66627</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Thu, 29 Sep 2011 17:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66627</guid>
		<description>&lt;p&gt;@Nick,&lt;/p&gt;
&lt;p&gt;The code was tested before I posted it, so I know it works. The only thing I can think of is you copied my code to the wrong location. I&#039;m guessing you put it in either a sheet or workbook module instead placing it in a standard module (Insert/Module for the VB editor&#039;s menu bar) where it needs to be. By the way, your first formula, as written, still won&#039;t work because the argument is text and you did not put quote marks around it... the second formula should work fine as written.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Nick,</p>
<p>The code was tested before I posted it, so I know it works. The only thing I can think of is you copied my code to the wrong location. I&#8217;m guessing you put it in either a sheet or workbook module instead placing it in a standard module (Insert/Module for the VB editor&#8217;s menu bar) where it needs to be. By the way, your first formula, as written, still won&#8217;t work because the argument is text and you did not put quote marks around it&#8230; the second formula should work fine as written.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66616</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Thu, 29 Sep 2011 10:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66616</guid>
		<description>&lt;p&gt;umm can&#039;t get it to work.. getting a #Name error&lt;br&gt;
I am using it as&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;=UpperOnly(Nick MANNING)&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;also tried&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container text default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;text codecolorer&quot;&gt;=UpperOnly(a1)&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;where A1 Contains the text Nick MANNING&lt;br&gt;
What am i doing wrong?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>umm can&#8217;t get it to work.. getting a #Name error<br />
I am using it as</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">=UpperOnly(Nick MANNING)</div>
</div>
<p>also tried</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container text default">
<div style="white-space: nowrap;" class="text codecolorer">=UpperOnly(a1)</div>
</div>
<p>where A1 Contains the text Nick MANNING<br />
What am i doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66596</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Wed, 28 Sep 2011 15:55:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66596</guid>
		<description>&lt;p&gt;@Nick,&lt;/p&gt;
&lt;p&gt;Does this function do what you want?&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; UpperOnly(&lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; S &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;) &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;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;, Z &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt;, Temp &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; Len(S)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; LCase(Mid(S, X, 1)) = Mid(S, X, 1) &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt; Mid(S, X, 1) = &lt;span class=&quot;st0&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;br&gt;
&#160; &lt;span class=&quot;kw1&quot;&gt;Next&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; Len(S) - 1&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Mid(S, X, 2) &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;[! ][! ]&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; S = Mid(S, X)&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; Z = Len(S) - 1 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; 1 &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; -1&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Mid(S, Z, 2) &lt;span class=&quot;kw1&quot;&gt;Like&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&quot;[! ][! ]&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; UpperOnly = Left(S, Z + 1)&lt;br&gt;
&#160; &#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&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>@Nick,</p>
<p>Does this function do what you want?</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> UpperOnly(<span class="kw1">ByVal</span> S <span class="kw1">As</span> <span class="kw1">String</span>) <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; <span class="kw1">Dim</span> X <span class="kw1">As</span> <span class="kw1">Long</span>, Z <span class="kw1">As</span> <span class="kw1">Long</span>, Temp <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; <span class="kw1">For</span> X = 1 <span class="kw1">To</span> Len(S)<br />
&nbsp; &nbsp; <span class="kw1">If</span> LCase(Mid(S, X, 1)) = Mid(S, X, 1) <span class="kw1">Then</span> Mid(S, X, 1) = <span class="st0">&#8221; &#8220;</span><br />
&nbsp; <span class="kw1">Next</span><br />
&nbsp; <span class="kw1">For</span> X = 1 <span class="kw1">To</span> Len(S) &#8211; 1<br />
&nbsp; &nbsp; <span class="kw1">If</span> Mid(S, X, 2) <span class="kw1">Like</span> <span class="st0">&#8220;[! ][! ]&#8220;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; S = Mid(S, X)<br />
&nbsp; &nbsp; &nbsp; <span class="kw1">For</span> Z = Len(S) &#8211; 1 <span class="kw1">To</span> 1 <span class="kw1">Step</span> -1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> Mid(S, Z, 2) <span class="kw1">Like</span> <span class="st0">&#8220;[! ][! ]&#8220;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UpperOnly = Left(S, Z + 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">Function</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">Next</span><br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><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: Nick</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66571</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Tue, 27 Sep 2011 09:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66571</guid>
		<description>&lt;p&gt;Excellent - Thank you very much. I will need to modify it a little as I have a few European names and it catches accented charaters and also the Capitalised letter from the second word of two worded first names- John Paul SMITH returns P SMITH.&lt;br&gt;
You response is fantasic and better than anything I have been able to find in months of posting and searching. Thanks again.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Excellent &#8211; Thank you very much. I will need to modify it a little as I have a few European names and it catches accented charaters and also the Capitalised letter from the second word of two worded first names- John Paul SMITH returns P SMITH.<br />
You response is fantasic and better than anything I have been able to find in months of posting and searching. Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dick Kusleika</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66558</link>
		<dc:creator>Dick Kusleika</dc:creator>
		<pubDate>Mon, 26 Sep 2011 22:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66558</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; ReturnCaps(sInput &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;Optional&lt;/span&gt; lStart &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Long&lt;/span&gt; = 1) &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; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; i &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; &#160; &lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; sReturn &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; &#160; &lt;br&gt;
&#160; &#160; sReturn = Mid$(sInput, lStart, Len(sInput))&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; i = Asc(&lt;span class=&quot;st0&quot;&gt;&quot;a&quot;&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; Asc(&lt;span class=&quot;st0&quot;&gt;&quot;z&quot;&lt;/span&gt;)&lt;br&gt;
&#160; &#160; &#160; &#160; sReturn = Replace$(sReturn, Chr$(i), &lt;span class=&quot;st0&quot;&gt;&quot;&quot;&lt;/span&gt;)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; i&lt;br&gt;
&#160; &#160; &lt;br&gt;
&#160; &#160; ReturnCaps = Trim(sReturn)&lt;br&gt;
&#160; &#160; &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;
&lt;p&gt;Use as &lt;code class=&quot;codecolorer text default&quot;&gt;&lt;span class=&quot;text&quot;&gt;=returncaps(A1,2)&lt;/span&gt;&lt;/code&gt;&lt;/p&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> ReturnCaps(sInput <span class="kw1">As</span> <span class="kw1">String</span>, <span class="kw1">Optional</span> lStart <span class="kw1">As</span> <span class="kw1">Long</span> = 1) <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">Dim</span> i <span class="kw1">As</span> <span class="kw1">Long</span><br />
&nbsp; &nbsp; <span class="kw1">Dim</span> sReturn <span class="kw1">As</span> <span class="kw1">String</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; sReturn = Mid$(sInput, lStart, Len(sInput))<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">For</span> i = Asc(<span class="st0">&#8220;a&#8221;</span>) <span class="kw1">To</span> Asc(<span class="st0">&#8220;z&#8221;</span>)<br />
&nbsp; &nbsp; &nbsp; &nbsp; sReturn = Replace$(sReturn, Chr$(i), <span class="st0">&#8220;&#8221;</span>)<br />
&nbsp; &nbsp; <span class="kw1">Next</span> i<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; ReturnCaps = Trim(sReturn)<br />
&nbsp; &nbsp; <br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
<p>Use as</p>
<div class="codecolorer-container text default codecolorer text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;span class=&quot;text&quot;&gt;=returncaps(A1,2)&lt;/span&gt;</div></div></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-66459</link>
		<dc:creator>Nick</dc:creator>
		<pubDate>Thu, 22 Sep 2011 03:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-66459</guid>
		<description>&lt;p&gt;How could I go about modifying this so I capture any ALL CAPS text in a string ie&lt;/p&gt;
&lt;p&gt;Nick MANNING  -- Result -- MANNING&lt;/p&gt;
&lt;p&gt;Jack THE RIPPER -- Result --- THE RIPPER&lt;/p&gt;
&lt;p&gt;Ben HILL J OFFER  -- Result -- HILL J OFFER&lt;/p&gt;
&lt;p&gt;The last example might be more difficult but one for the first two would be great.&lt;/p&gt;
&lt;p&gt;Many thanks &lt;/p&gt;
&lt;p&gt;Nick&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>How could I go about modifying this so I capture any ALL CAPS text in a string ie</p>
<p>Nick MANNING  &#8212; Result &#8212; MANNING</p>
<p>Jack THE RIPPER &#8212; Result &#8212; THE RIPPER</p>
<p>Ben HILL J OFFER  &#8212; Result &#8212; HILL J OFFER</p>
<p>The last example might be more difficult but one for the first two would be great.</p>
<p>Many thanks </p>
<p>Nick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rakhmat</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-24224</link>
		<dc:creator>rakhmat</dc:creator>
		<pubDate>Mon, 21 May 2007 12:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-24224</guid>
		<description>&lt;p&gt;can somebody help me, how to show/parse only the consonant character in excel&lt;br&gt;
for example :&lt;br&gt;
Asia Global Media ----&gt; SGLBLMD&lt;/p&gt;
&lt;p&gt;please email me the formula,&lt;/p&gt;
&lt;p&gt;many thanks&lt;/p&gt;
&lt;p&gt;Rakhmat&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>can somebody help me, how to show/parse only the consonant character in excel<br />
for example :<br />
Asia Global Media &#8212;-&gt; SGLBLMD</p>
<p>please email me the formula,</p>
<p>many thanks</p>
<p>Rakhmat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Williams</title>
		<link>http://www.dailydoseofexcel.com/archives/2007/02/21/find-position-of-first-capital-letter-in-a-string/#comment-22640</link>
		<dc:creator>Charles Williams</dc:creator>
		<pubDate>Fri, 02 Mar 2007 19:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=1610#comment-22640</guid>
		<description>&lt;p&gt;Fastest method seems to be a UDF using a Byte array. This function takes 16 millisecs for 2000 strings and 8 millisecs when coded as an array formula.&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;Public&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; FirstCap(theRange &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range) &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;Dim&lt;/span&gt; aByte() &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Byte&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; j &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;br&gt;
FirstCap = -1&lt;br&gt;
aByte = theRange.Value2&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; j = 0 &lt;span class=&quot;kw1&quot;&gt;To&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;UBound&lt;/span&gt;(aByte, 1) &lt;span class=&quot;kw1&quot;&gt;Step&lt;/span&gt; 2&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; aByte(j) &#060; 91 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; aByte(j) &#062; 64 &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; FirstCap = (j + 2) / 2&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Exit&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; j&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;
&lt;p&gt;Overall the VBA UDFs and MOREFUNC are significantly faster (8 to 56 millisecs versus 320-380 millisecs) than the array formulae.&lt;/p&gt;
&lt;p&gt;Tests were done on 2000 character strings length 26 with a single randomly selected upper case character. All timings in milliseconds using Range.calculate in manual calculate mode.&lt;/p&gt;
&lt;p&gt;Timings in Millisecs:&lt;br&gt;
Firstcap (Byte array)                                          16&lt;br&gt;
AFirstcap (array function version of byte array)                8&lt;br&gt;
If Mid(Cell.Value, FirstCap2, 1) Like &quot;[A-Z]&quot;                  56&lt;br&gt;
If Mid$(tmp, i, 1)  Mid$(strInp, i, 1) Then                  41&lt;br&gt;
=MATCH(TRUE,ISERR(FIND(MID(A1,ROW($1:$255),1),LOWER(A1))),0)  323&lt;br&gt;
Doug&#039;s array function                                          17&lt;br&gt;
=MATCH(TRUE,ABS(CODE(MID(A1,ROW($1:$255),1))-77.5)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Fastest method seems to be a UDF using a Byte array. This function takes 16 millisecs for 2000 strings and 8 millisecs when coded as an array formula.</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Public</span> <span class="kw1">Function</span> FirstCap(theRange <span class="kw1">As</span> Range) <span class="kw1">As</span> <span class="kw1">Long</span><br />
<span class="kw1">Dim</span> aByte() <span class="kw1">As</span> <span class="kw1">Byte</span><br />
<span class="kw1">Dim</span> j <span class="kw1">As</span> <span class="kw1">Long</span></p>
<p>FirstCap = -1<br />
aByte = theRange.Value2<br />
<span class="kw1">For</span> j = 0 <span class="kw1">To</span> <span class="kw1">UBound</span>(aByte, 1) <span class="kw1">Step</span> 2<br />
&nbsp; &nbsp; <span class="kw1">If</span> aByte(j) &amp;#60; 91 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">If</span> aByte(j) &amp;#62; 64 <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; FirstCap = (j + 2) / 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Exit</span> <span class="kw1">For</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
<span class="kw1">Next</span> j<br />
<span class="kw1">End</span> <span class="kw1">Function</span></div>
</div>
<p>Overall the VBA UDFs and MOREFUNC are significantly faster (8 to 56 millisecs versus 320-380 millisecs) than the array formulae.</p>
<p>Tests were done on 2000 character strings length 26 with a single randomly selected upper case character. All timings in milliseconds using Range.calculate in manual calculate mode.</p>
<p>Timings in Millisecs:<br />
Firstcap (Byte array)                                          16<br />
AFirstcap (array function version of byte array)                8<br />
If Mid(Cell.Value, FirstCap2, 1) Like &#8220;[A-Z]&#8221;                  56<br />
If Mid$(tmp, i, 1)  Mid$(strInp, i, 1) Then                  41<br />
=MATCH(TRUE,ISERR(FIND(MID(A1,ROW($1:$255),1),LOWER(A1))),0)  323<br />
Doug&#8217;s array function                                          17<br />
=MATCH(TRUE,ABS(CODE(MID(A1,ROW($1:$255),1))-77.5)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

