<?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/"
	>

<channel>
	<title>nandeshwar.info &#187; String Operations</title>
	<atom:link href="http://nandeshwar.info/category/string-operations/feed/" rel="self" type="application/rss+xml" />
	<link>http://nandeshwar.info</link>
	<description></description>
	<lastBuildDate>Mon, 12 Dec 2011 21:33:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Count Text in a Range</title>
		<link>http://nandeshwar.info/2009/04/24/count-text-in-a-range/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=count-text-in-a-range</link>
		<comments>http://nandeshwar.info/2009/04/24/count-text-in-a-range/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 14:21:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[excel functions]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[wildcard]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=191</guid>
		<description><![CDATA[Counting text in a range is easy. For example, if you would like count how many times &#8220;text&#8221; is in a specified range (named data), you can write something like this: =COUNTIF(data,"*text*") This formula will give you the count of all the cells where Excel found &#8220;text&#8221; at any place. But let&#8217;s say you want [...]]]></description>
			<content:encoded><![CDATA[<p>Counting text in a range is easy. For example, if you would like count how many times &#8220;text&#8221; is in a specified range (named data), you can write something like this:<br />
<code>=COUNTIF(data,"*text*")</code></p>
<p>This formula will give you the count of all the cells where Excel found &#8220;text&#8221; at any place.</p>
<p>But let&#8217;s say you want to count wildcard characters in a range, then you can write something like this:<br />
<code>=SUM(IF(NOT(ISERR(FIND("*",data))),1,0))</code></p>
<p>This formula should be entered as an array formula with Ctrl + Shift + Enter. Usually, wildcard can be &#8220;escaped&#8221; using a tilde (~), but the <code>FIND</code> function doesn&#8217;t understand wildcard characters like the <code>SEARCH</code> function does.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/04/24/count-text-in-a-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Student&#8217;s t-test for equal means</title>
		<link>http://nandeshwar.info/2008/10/29/students-t-test-for-equal-means/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=students-t-test-for-equal-means</link>
		<comments>http://nandeshwar.info/2008/10/29/students-t-test-for-equal-means/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 13:06:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Useful Procedures]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2008/10/29/students-t-test-for-equal-means/</guid>
		<description><![CDATA[If you do not wish to enter complex formula in Excel and you already have calculated average, count, and variance for your samples(Tip:use a PivotTable), then you can use these user-defined functions to calculate the t-test stat value and degrees of freedom required to do hypothesis testing. Both the functions provide an optional argument for [...]]]></description>
			<content:encoded><![CDATA[<p>If you do not wish to enter complex formula in Excel and you already have calculated average, count, and variance for your samples(Tip:use a PivotTable), then you can use these user-defined functions to calculate the t-test stat value and degrees of freedom required to do hypothesis testing. Both the functions provide an optional argument for the assumption of equal variances; by default it is set to false.</p>
<p>Here&#8217;s the code for t-test:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'---------------------------------------------------------------------------------------
</span><span style="color: #008000;">' Procedure : TTESTM
</span><span style="color: #008000;">' DateTime  : 10/29/2008 08:35
</span><span style="color: #008000;">' Author    :
</span><span style="color: #008000;">' Purpose   : To get the t-stat value when comparing two means with an optional input
</span><span style="color: #008000;">'               for equal or unequal variances
</span><span style="color: #008000;">'               by default the function assumes that the user is comparing means with unequal variances
</span><span style="color: #008000;">' davg1 is the mean of first sample
</span><span style="color: #008000;">' dcnt1 is the sample size of sample 1 
</span><span style="color: #008000;">' dvar1 is the variance of first samaple 
</span><span style="color: #008000;">' davg2 is the mean of second sample
</span><span style="color: #008000;">' dcnt2 is the sample size of sample 2 
</span><span style="color: #008000;">' dvar2 is the variance of second samaple 
</span><span style="color: #008000;">' blnEqVar set TRUE to assume equal variance for the test
</span><span style="color: #008000;">'---------------------------------------------------------------------------------------
</span>
<span style="color: #000080;">Public</span> <span style="color: #000080;">Function</span> TTESTM(davg1 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dcnt1 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dvar1 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, davg2 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dcnt2 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dvar2 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, <span style="color: #000080;">Optional</span> blnEqVar <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span> = <span style="color: #000080;">False</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
&nbsp;
<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> TTESTM_Error
<span style="color: #000080;">Dim</span> dResult <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dNumer <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dDenon <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dPooledVar <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
&nbsp;
dNumer = davg1 - davg2
&nbsp;
<span style="color: #008000;">'if equal variances are not assumed
</span><span style="color: #008000;">'http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm
</span><span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> blnEqVar <span style="color: #000080;">Then</span>
	dDenon = Sqr((dvar1 ^ 2 / dcnt1) + (dvar2 ^ 2 / dcnt2))
<span style="color: #000080;">Else</span>
<span style="color: #008000;">'if equal variances are assumed, then calculated the pooled variance
</span>	dPooledVar = Sqr((((dcnt1 - 1) * dvar1 ^ 2) + ((dcnt2 - 1) * dvar2 ^ 2)) / (dcnt1 + dcnt2 - 2))
	dDenon = dPooledVar * Sqr((1 / dcnt1) + (1 / dcnt2))
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
dResult = dNumer / dDenon
&nbsp;
TTESTM = dResult
<span style="color: #000080;">Exit</span> <span style="color: #000080;">Function</span>
&nbsp;
TTESTM_Error:
	TTESTM = Null
&nbsp;
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>Code for degrees of freedom</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #008000;">'---------------------------------------------------------------------------------------
</span><span style="color: #008000;">' Procedure : DOFTTESTM
</span><span style="color: #008000;">' DateTime  : 10/29/2008 08:50
</span><span style="color: #008000;">' Author    :
</span><span style="color: #008000;">' Purpose   : To get the degrees of freedom for the t-test when comparing two means with an optional input
</span><span style="color: #008000;">'               for equal or unequal variances
</span><span style="color: #008000;">'               by default the function assumes that the user is comparing means with unequal variances
</span>
<span style="color: #008000;">' dcnt1 is the sample size of sample 1 
</span><span style="color: #008000;">' dvar1 is the variance of first samaple 
</span><span style="color: #008000;">' dcnt2 is the sample size of sample 2 
</span><span style="color: #008000;">' dvar2 is the variance of second samaple 
</span><span style="color: #008000;">' blnEqVar set TRUE to assume equal variance for the test
</span><span style="color: #008000;">'---------------------------------------------------------------------------------------
</span><span style="color: #008000;">'
</span><span style="color: #000080;">Public</span> <span style="color: #000080;">Function</span> DOFTTESTM(dcnt1 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dvar1 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dcnt2 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dvar2 <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, <span style="color: #000080;">Optional</span> blnEqVar <span style="color: #000080;">As</span> <span style="color: #000080;">Boolean</span> = <span style="color: #000080;">False</span>) <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
&nbsp;
<span style="color: #000080;">Dim</span> dResult <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dNumer <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>, dDenon <span style="color: #000080;">As</span> <span style="color: #000080;">Double</span>
&nbsp;
<span style="color: #000080;">On</span> <span style="color: #000080;">Error</span> <span style="color: #000080;">GoTo</span> DOFTTESTM_Error
<span style="color: #008000;">'if equal variances are not assumed, then use a complicated formula to compute degrees of freedom
</span><span style="color: #008000;">'http://www.itl.nist.gov/div898/handbook/eda/section3/eda353.htm
</span><span style="color: #000080;">If</span> <span style="color: #000080;">Not</span> blnEqVar <span style="color: #000080;">Then</span>
	dNumer = ((dvar1 ^ 2 / dcnt1) + (dvar2 ^ 2 / dcnt2)) ^ 2
	dDenon = ((dvar1 ^ 2 / dcnt1) ^ 2 / (dcnt1 - 1)) + ((dvar2 ^ 2 / dcnt2) ^ 2 / (dcnt2 - 1))
	dResult = dNumer / dDenon
<span style="color: #000080;">Else</span>
	dResult = dcnt1 + dcnt2 - 2
<span style="color: #000080;">End</span> <span style="color: #000080;">If</span>
&nbsp;
DOFTTESTM = dResult
&nbsp;
<span style="color: #000080;">Exit</span> <span style="color: #000080;">Function</span>
&nbsp;
DOFTTESTM_Error:
	DOFTTESTM = Null
&nbsp;
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2008/10/29/students-t-test-for-equal-means/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert Text to Uppercase</title>
		<link>http://nandeshwar.info/2007/09/17/convert-text-to-uppercase/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=convert-text-to-uppercase</link>
		<comments>http://nandeshwar.info/2007/09/17/convert-text-to-uppercase/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 13:21:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Useful Procedures]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2007/09/17/convert-text-to-uppercase/</guid>
		<description><![CDATA[If you want to convert the text to uppercase, use the following code; however, I recommend downloading ASAP Utilities, it has many functionalities, including text conversion. It doesn&#8217;t offer source code though. Here&#8217;s my code for uppercase conversion:(If you want to convert your text to lowercase, replace Ucase with Lcase function in the code) &#8216;Will [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to convert the text to uppercase, use the following code; however, I recommend downloading <a href="http://www.asap-utilities.com/">ASAP Utilities</a>, it has many functionalities, including text conversion. It doesn&#8217;t offer source code though. </p>
<p>Here&#8217;s my code for uppercase conversion:<br />(If you want to convert your text to lowercase, replace Ucase with Lcase function in the code)
<div id="code"><font face="Courier"><span style="color:#007F00;">&#8216;Will convert selected range to Upper case, using array</span><br /><span style="color:#00007F;">Sub</span> Conv2UCase()<br /><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> Conv2UCase_Error</p>
<p><span style="color:#00007F;">Dim</span> vDataArr <span style="color:#00007F;">As</span> <span style="color:#00007F;">Variant</span><br /><span style="color:#00007F;">Dim</span> lUpperBndRow <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lUpperBndCol <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br /><span style="color:#00007F;">Dim</span> lRow <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lCol <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span></p>
<p><span style="color:#007F00;">&#8216;store selected values in an array</span><br />vDataArr = Selection<br /><span style="color:#007F00;">&#8216;get the upper bound of rows</span><br />lUpperBndRow = <span style="color:#00007F;">UBound</span>(vDataArr, 1)<br /><span style="color:#007F00;">&#8216;get the upper bound of cols</span><br />lUpperBndCol = <span style="color:#00007F;">UBound</span>(vDataArr, 2)</p>
<p><span style="color:#007F00;">&#8216;Start a loop to go through all the elements of the array</span><br /><span style="color:#00007F;">For</span> lRow = 1 <span style="color:#00007F;">To</span> lUpperBndRow<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> lCol = 1 <span style="color:#00007F;">To</span> lUpperBndCol<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;Check if the value is text, if not don&#8217;t convert</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> WorksheetFunction.IsText(vDataArr(lRow, lCol)) <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;Convert values to upper case</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;vDataArr(lRow, lCol) = UCase(vDataArr(lRow, lCol))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">End</span> <span style="color:#00007F;">If</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> lCol<br /><span style="color:#00007F;">Next</span> lRow<br /><span style="color:#007F00;">&#8216;Return the converted values to the range</span><br />Selection = vDataArr<br /><span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span></p>
<p>Conv2UCase_Error:<br />&#160;&#160;&#160;&#160;MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; &#8220;) in Sub:Conv2UCase&#8221;<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Sub</span></font></div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2007/09/17/convert-text-to-uppercase/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A function to reverse a string</title>
		<link>http://nandeshwar.info/2007/08/16/a-function-to-reverse-a-string/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=a-function-to-reverse-a-string</link>
		<comments>http://nandeshwar.info/2007/08/16/a-function-to-reverse-a-string/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 14:19:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Useful Procedures]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2007/08/16/a-function-to-reverse-a-string/</guid>
		<description><![CDATA[Very simple, uses the VBA function StrReverse to reverse the input string. &#8216;A function to reverse a string provided as input&#8216;For example, the string &#8220;abcd&#8221; will become &#8220;dcba&#8221;&#8216;Uses the VBA function StrReversePublic Function ReverseString(sInputString As String) As StringOn Error GoTo ReverseString_Error&#160;&#160;&#160;&#160;ReverseString = StrReverse(sInputString)&#160;&#160;&#160;&#160;Exit Function ReverseString_Error:&#160;&#160;&#160;&#160;ReverseString = &#8220;#ERROR#&#8221;End Function]]></description>
			<content:encoded><![CDATA[<p>Very simple, uses the VBA function StrReverse to reverse the input string.
<div id="code"><font face="Courier"><span style="color:#007F00;">&#8216;A function to reverse a string provided as input</span><br /><span style="color:#007F00;">&#8216;For example, the string &#8220;abcd&#8221; will become &#8220;dcba&#8221;</span><br /><span style="color:#007F00;">&#8216;Uses the VBA function StrReverse</span><br /><span style="color:#00007F;">Public</span> <span style="color:#00007F;">Function</span> ReverseString(sInputString <span style="color:#00007F;">As</span> String) <span style="color:#00007F;">As</span> String<br /><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> ReverseString_Error<br />&#160;&#160;&#160;&#160;<br />ReverseString = StrReverse(sInputString)<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Function</span></p>
<p>ReverseString_Error:<br />&#160;&#160;&#160;&#160;ReverseString = &#8220;#ERROR#&#8221;<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Function</span></font></div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2007/08/16/a-function-to-reverse-a-string/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Concatenate function</title>
		<link>http://nandeshwar.info/2007/07/24/concatenate-function/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=concatenate-function</link>
		<comments>http://nandeshwar.info/2007/07/24/concatenate-function/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 16:24:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Useful Procedures]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2007/07/24/concatenate-function/</guid>
		<description><![CDATA[Oh, man, I can&#8217;t tell how useful that concatenate function is. One repetitive use I found is to create OR/AND conditions for Access queries. I copy-paste the field values of a column from Access, do some filtering and my conditions are ready. Then I use this concatfunc to create a string to use in my [...]]]></description>
			<content:encoded><![CDATA[<p>Oh, man, I can&#8217;t tell how useful that <a href="http://www.nandeshwar.info/projects/xlblog/2007/06/range-concatenation-with-character.html">concatenate function</a> is.</p>
<p>One repetitive use I found is to create OR/AND conditions for Access queries. I copy-paste the field values of a column from Access, do some filtering and my conditions are ready. Then I use this concatfunc to create a string to use in my Access query.</p>
<p>For example, look at this print screen:<br /><a href="http://www.nandeshwar.info/projects/xlblog/uploaded_images/concatfuncex-714057.JPG"><img style="cursor:hand;" src="http://www.nandeshwar.info/projects/xlblog/uploaded_images/concatfuncex-714053.JPG" border="0" alt="" /></a></p>
<p>The Range A1:A4 houses the string condition I want to use in my Access query to restrict the fruits from my data. In cell B1 I have the formula
<div id="code">=PERSONAL.XLS!concatfunc(A1:A4,CHAR(34) &amp; &#8221; or &#8221; &amp; CHAR(34))</div>
<p>, and the return string from this function is listed in cell B1.</p>
<p>Now, all you have to do is copy and paste this in Access criteria and put a quotation mark at the start and at the end of this string.</p>
<p>I have found one more use of this when I want to store some values in an Array, using the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vafctarray.asp">Array function in VBA</a>.</p>
<p>One more print screen:<br /><a href="http://www.nandeshwar.info/projects/xlblog/uploaded_images/concatfuncex2-714067.JPG"><img style="cursor:hand;" src="http://www.nandeshwar.info/projects/xlblog/uploaded_images/concatfuncex2-714065.JPG" border="0" alt="" /></a></p>
<p>In this example, I insert a comma (CHAR(44) instead of string OR, and this function returns a string that I can use in VBA to store these values in an array using Array function, after adding a quotation mark, of course, at the start and at the end.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2007/07/24/concatenate-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Range Concatenation with a character</title>
		<link>http://nandeshwar.info/2007/06/29/range-concatenation-with-a-character/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=range-concatenation-with-a-character</link>
		<comments>http://nandeshwar.info/2007/06/29/range-concatenation-with-a-character/#comments</comments>
		<pubDate>Fri, 29 Jun 2007 14:03:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Useful Procedures]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2007/06/29/range-concatenation-with-a-character/</guid>
		<description><![CDATA[Are you frustrated that you have to concatenate a range, and you have to do that using CONCATENATE formula by entering each cell and typing a comma after every cell? Well, here&#8217;s a solution to it. A procedure or a function whatever you like. If you use the procedure, it allows you to choose the [...]]]></description>
			<content:encoded><![CDATA[<p>Are you frustrated that you have to concatenate a range, and you have to do that using CONCATENATE formula by entering each cell and typing a comma after every cell? Well, here&#8217;s a solution to it. A procedure or a function whatever you like. If you use the procedure, it allows you to choose the input range, concatenate character, and the output range. If you use the function, then you can enter the optional concatenate character (by default it is a comma (,)), and the input range.</p>
<p>Here are both:</p>
<p>Procedure:</p>
<div id="code"><span style="font-family: Courier;"><span style="color:#00007F;">Public</span> <span style="color:#00007F;">Sub</span> ConCatwChar()<br />
<span style="color:#00007F;">Dim</span> sChar2bAdded <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span>, rngRng2bCated <span style="color:#00007F;">As</span> Range, sOutput <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span>, rngTarget <span style="color:#00007F;">As</span> Range, c <span style="color:#00007F;">As</span> Range<br />
<span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> ConCatwChar_Error<br />
<span style="color:#007F00;">&#8216;You could use this line to return the concatenated string in this cell</span><br />
<span style="color:#007F00;">&#8216;Set rngTarget = ActiveCell</span></span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">Set</span></span><span style="font-family: Courier;"> rngRng2bCated = Application.InputBox(prompt:=&#8221;Select the range you&#8217;d like to concatenate with a charcter&#8221;, _<br />
Title:=&#8221;Select Range&#8221;, Type:=8)</span></p>
<p><span style="color:#00007F;">If</span> rngRng2bCated <span style="color:#00007F;">Is</span> <span style="color:#00007F;">Nothing</span> <span style="color:#00007F;">Then</span> <span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span></p>
<p><span style="color:#007F00;">&#8216;You could use this line to set the default to a comma and remove the inputbox line</span><br />
<span style="color:#007F00;">&#8216;sChar2bAdded = &#8220;,&#8221;</span><br />
sChar2bAdded = InputBox(&#8220;Enter the character you&#8217;d like to add between other cells&#8221;, &#8220;Enter Character&#8221;, &#8220;,&#8221;)</p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">Set</span></span><span style="font-family: Courier;"> rngTarget = Application.InputBox(prompt:=&#8221;Select the range you&#8217;d like the output&#8221;, _<br />
Title:=&#8221;Select Range&#8221;, Type:=8)</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">For</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Each</span> c <span style="color:#00007F;">In</span> rngRng2bCated<br />
sOutput = sOutput &amp; c.Value &amp; sChar2bAdded<br />
<span style="color:#00007F;">Next</span> c</span></p>
<p><span style="font-family: Courier;">sOutput = Left(sOutput, Len(sOutput) &#8211; Len(sChar2bAdded))<br />
rngTarget = sOutput</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">On</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> 0<br />
<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span></span></p>
<p>ConCatwChar_Error:<br />
MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; &#8220;) in procedure ConCatwChar&#8221;<br />
<span style="color:#00007F;">End</span> <span style="color:#00007F;">Sub</span></div>
<p>Here&#8217;s the function:</p>
<div id="code"><span style="font-family: Courier;"><span style="color:#007F00;">&#8216;You can change the option string character to nothing &#8220;&#8221; so that you get concatenated string without a character in between</span><br />
<span style="color:#00007F;">Public</span> <span style="color:#00007F;">Function</span> ConCatFunc(rngRng2bCated <span style="color:#00007F;">As</span> Range, <span style="color:#00007F;">Optional</span> sChar2bAdded <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span> = &#8220;,&#8221;) <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span><br />
<span style="color:#00007F;">Dim</span> sOutput <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span>, c <span style="color:#00007F;">As</span> Range</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">On</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> ConCatFunc_Error</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">For</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Each</span> c <span style="color:#00007F;">In</span> rngRng2bCated<br />
sOutput = sOutput &amp; c.Value &amp; sChar2bAdded<br />
<span style="color:#00007F;">Next</span> c<br />
sOutput = Left(sOutput, Len(sOutput) &#8211; Len(sChar2bAdded))<br />
ConCatFunc = sOutput</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">On</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> 0<br />
<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Function</span></span></p>
<p><span style="font-family: Courier;">ConCatFunc_Error:<br />
ConCatFunc = &#8220;#Error#&#8221;</span></p>
<p><span style="color:#00007F;"><span style="font-family: Courier;">End</span></span><span style="font-family: Courier;"> <span style="color:#00007F;">Function</span></span><br />
<a href="http://www.nandeshwar.info/projects/xlblog/uploaded_images/ExcelConcatwChar-790103.JPG"><img style="float:left;cursor:hand;margin:0 10px 10px 0;" src="http://www.nandeshwar.info/projects/xlblog/uploaded_images/ExcelConcatwChar-790099.JPG" border="0" alt="" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2007/06/29/range-concatenation-with-a-character/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text Search Count</title>
		<link>http://nandeshwar.info/2007/06/29/text-search-count/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=text-search-count</link>
		<comments>http://nandeshwar.info/2007/06/29/text-search-count/#comments</comments>
		<pubDate>Fri, 29 Jun 2007 13:40:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[A2 A16]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[SUM]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2007/06/29/text-search-count/</guid>
		<description><![CDATA[If you want to do a text search count in a range, you can use the following formulas:Where D3 is the search text and the range A2:A16 houses the data. An array formula using SUM and SEARCH {=SUM(IF(ISERROR(SEARCH(D3,A2:A16)),0,1))} Another using COUNTIF: =COUNTIF(A2:A16,&#8221;*&#8221;&#38;D3&#38;&#8221;*&#8221;) This picture might make it clear:]]></description>
			<content:encoded><![CDATA[<p>If you want to do a text search count in a range, you can use the following formulas:<br />Where D3 is the search text and the range A2:A16 houses the data.</p>
<p>An array formula using SUM and SEARCH
<div id="code">{=SUM(IF(ISERROR(SEARCH(D3,A2:A16)),0,1))}</div>
<p>Another using COUNTIF:
<div id="code">=COUNTIF(A2:A16,&#8221;*&#8221;&amp;D3&amp;&#8221;*&#8221;)</div>
<p>This picture might make it clear:<br /><a href="http://www.nandeshwar.info/projects/xlblog/uploaded_images/ExcelCount-723247.JPG"><img style="display:block;text-align:center;cursor:hand;margin:0 auto 10px;" src="http://www.nandeshwar.info/projects/xlblog/uploaded_images/ExcelCount-723244.JPG" border="0" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2007/06/29/text-search-count/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Specific number of zeros to a value</title>
		<link>http://nandeshwar.info/2006/02/08/add-specific-number-of-zeros-to-a-value/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=add-specific-number-of-zeros-to-a-value</link>
		<comments>http://nandeshwar.info/2006/02/08/add-specific-number-of-zeros-to-a-value/#comments</comments>
		<pubDate>Wed, 08 Feb 2006 19:47:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[excel functions]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2006/02/08/add-specific-number-of-zeros-to-a-value/</guid>
		<description><![CDATA[This is one of the finest forumlae I&#8217;ve ever seen. Check this post at MrExcel. If you want to have a value specific number of digits otherwise add zeros in front of it, this formula could be used: =TEXT(A1,REPT(&#8220;0&#8243;,n)) where n is the number of digits you want. So 4555 becomes 000004555 with formula =TEXT(4555,REPT(&#8220;0&#8243;,9))]]></description>
			<content:encoded><![CDATA[<p>This is one of the finest forumlae I&#8217;ve ever seen. Check this <a href="http://www.mrexcel.com/board2/viewtopic.php?t=193924">post</a> at MrExcel.</p>
<p>If you want to have a value specific number of digits otherwise add zeros in front of it, this formula could be used:<br />
=TEXT(A1,REPT(&#8220;0&#8243;,<em>n</em>))<br />
where n is the number of digits you want.</p>
<p>So 4555 becomes 000004555 with formula =TEXT(4555,REPT(&#8220;0&#8243;,9))</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2006/02/08/add-specific-number-of-zeros-to-a-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Random Text Generator</title>
		<link>http://nandeshwar.info/2005/10/23/random-text-generator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=random-text-generator</link>
		<comments>http://nandeshwar.info/2005/10/23/random-text-generator/#comments</comments>
		<pubDate>Sun, 23 Oct 2005 16:41:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[Number Err]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2005/10/23/random-text-generator/</guid>
		<description><![CDATA[This function will return random text (a-z) for the specified length. For ex. Randtxt(5) will return xythp. &#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8216; Procedure : Randtxt&#8216; DateTime&#160;&#160;: 10/23/2005 11:54&#8216; Author&#160;&#160;&#160;&#160;: Ashutosh&#8216; Purpose&#160;&#160; :This function will return random text for the specified no. of chars Function Randtxt(nochars As Byte) As String&#160;&#160;&#160;&#160;On Error GoTo Randtxt_Error&#160;&#160;&#160;&#160;If nochars = 0 Then Exit Function&#160;&#160;&#160;&#160;Dim sResult [...]]]></description>
			<content:encoded><![CDATA[<p>This function will return random text (a-z) for the specified length. For ex. Randtxt(5) will return xythp.
<div id="code"><font face="Courier"><span style="color:#007F00;">&#8216;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</span><br /><span style="color:#007F00;">&#8216; Procedure : Randtxt</span><br /><span style="color:#007F00;">&#8216; DateTime&nbsp;&nbsp;: 10/23/2005 11:54</span><br /><span style="color:#007F00;">&#8216; Author&nbsp;&nbsp;&nbsp;&nbsp;: Ashutosh</span><br /><span style="color:#007F00;">&#8216; Purpose&nbsp;&nbsp; :This function will return random text for the specified no. of chars</span></p>
<p><span style="color:#00007F;">Function</span> Randtxt(nochars <span style="color:#00007F;">As</span> <span style="color:#00007F;">Byte</span>) <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> Randtxt_Error<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">If</span> nochars = 0 <span style="color:#00007F;">Then</span> <span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Function</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Dim</span> sResult <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span>, i <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sResult = &#8220;&#8221;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">For</span> i = 1 <span style="color:#00007F;">To</span> nochars<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sResult = sResult &amp; Chr(Int(Rnd * (122 &#8211; 97) + 97))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Next</span> i<br />&nbsp;&nbsp;&nbsp;&nbsp;Randtxt = sResult<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Function</span><br />Randtxt_Error:<br />&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; &#8220;) in function Randtxt&#8221;<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Function</span></font></div>
<p>This sub will return random text for the specified length and number of random texts needed. 
<div id="code"><font face="Courier"><span style="color:#007F00;">&#8216; Procedure : Randtxt1</span><br /><span style="color:#007F00;">&#8216; DateTime&nbsp;&nbsp;: 10/23/2005 12:12</span><br /><span style="color:#007F00;">&#8216; Author&nbsp;&nbsp;&nbsp;&nbsp;: Ashutosh</span><br /><span style="color:#007F00;">&#8216; Purpose&nbsp;&nbsp; : This sub will return and no. of random text random text for the</span><br /><span style="color:#007F00;">&#8216;specified no. of chars needed starting from the activecell</span><br /><span style="color:#00007F;">Sub</span> Randtxt1()<br /><span style="color:#00007F;">Dim</span> nochars <span style="color:#00007F;">As</span> <span style="color:#00007F;">Byte</span><br /><span style="color:#00007F;">Dim</span> nos <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br />nochars = InputBox(&#8220;Enter the length of the random text&#8221;, , 1)<br />nos = InputBox(&#8220;Enter the number the random texts needed&#8221;, , 1)<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> Randtxt_Error1<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">If</span> nochars = 0 <span style="color:#00007F;">Then</span> <span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Dim</span> sResult <span style="color:#00007F;">As</span> <span style="color:#00007F;">String</span>, i <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, j <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">For</span> j = 1 <span style="color:#00007F;">To</span> nos<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sResult = &#8220;&#8221;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">For</span> i = 1 <span style="color:#00007F;">To</span> nochars<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sResult = sResult &amp; Chr(Int(Rnd * (122 &#8211; 97) + 97))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Next</span> i<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ActiveCell.Offset(j &#8211; 1, 0) = sResult<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Next</span> j<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span><br />Randtxt_Error1:<br />&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221;) in procedure Randtxt&#8221;<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Sub</span></font></div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2005/10/23/random-text-generator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>String Operations</title>
		<link>http://nandeshwar.info/2005/03/09/string-operations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=string-operations</link>
		<comments>http://nandeshwar.info/2005/03/09/string-operations/#comments</comments>
		<pubDate>Wed, 09 Mar 2005 16:48:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[ANSI]]></category>
		<category><![CDATA[ASCII]]></category>
		<category><![CDATA[LHS]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2005/03/09/string-operations/</guid>
		<description><![CDATA[I found this on microsoft&#8217;s website. I didn&#8217;t know that I can use MID function on the LHS and converting string to ASCII will speed up the process. Cool!! &#8220;The following points provide suggestions for ways to enhance the performance of string operations: Minimize concatenation operations when you can. You can use the Mid function [...]]]></description>
			<content:encoded><![CDATA[<p>I found this on microsoft&#8217;s website. I didn&#8217;t know that I can use MID function on the LHS and converting string to ASCII will speed up the process. Cool!!</p>
<p> &#8220;The following points provide suggestions for ways to enhance the performance of string operations: <br />Minimize concatenation operations when you can. You can use the Mid function on the left side of the equal sign to replace characters within the string, rather than concatenating them together. The drawback to using the Mid function is that the replacement string must be the same length as the substring you are replacing. 
<div id="code">Dim strText As String</p>
<p>strText = &#8216;this is a test&#8217;<br />Mid(strText, 11, 4) = &#8216;tent&#8217;<br />Debug.Print strText</div>
<p>Microsoft Visual Basic for Applications (VBA) provides a number of intrinsic string constants that you can use to replace function calls. For example, you can use the vbCrLf constant to represent a carriage return/linefeed combination within a string, rather than using Chr(13) &amp; Chr(10). <br />String-comparison operations are slow. Sometimes, you can avoid them by converting a character in the string to an ANSI value. For example, the following code checks whether the first character in a string is a space: 
<div id="code">If Asc(strText) = 32 Then</div>
<p>The previous code is faster than the following: 
<div id="code">If Left(strText, 1) = &#8216; &#8216; Then&#8221;</div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2005/03/09/string-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

