<?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; UDF</title>
	<atom:link href="http://nandeshwar.info/tag/udf/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>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>Isworksheetopen and Isworkbookopen functions</title>
		<link>http://nandeshwar.info/2005/02/23/isworksheetopen-and-isworkbookopen-functions/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=isworksheetopen-and-isworkbookopen-functions</link>
		<comments>http://nandeshwar.info/2005/02/23/isworksheetopen-and-isworkbookopen-functions/#comments</comments>
		<pubDate>Wed, 23 Feb 2005 05:14:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2005/02/23/isworksheetopen-and-isworkbookopen-functions/</guid>
		<description><![CDATA[Here&#8217;s a IsWorkbookOpen function to check if a workbook is open or not. Returns TRUE or FALSE Public Function IsWorkbookOpen(ByVal wkbkname As String) As Boolean Dim Wb As Workbook &#8216;check if its already opened in the Windows collection For Each Wb In Workbooks If Wb.Name = wkbkname Then IsWorkbookOpen = True GoTo exitsub End If [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a IsWorkbookOpen function to check if a workbook is open or not. Returns TRUE or FALSE</p>
<div id="code">
<div><span style="font-family:Courier;"><span style="color:#00007f;">Public Function IsWorkbookOpen(ByVal wkbkname As String) As Boolean</span></span></div>
<div><span style="font-family:Courier;"><span style="color:#00007f;">Dim</span> Wb <span style="color:#00007f;">As</span> Workbook<br />
<span style="color:#007f00;">&#8216;check if its already opened in the Windows collection</span><br />
<span style="color:#00007f;">For</span> <span style="color:#00007f;">Each</span> Wb <span style="color:#00007f;">In</span> Workbooks<br />
<span style="color:#00007f;">If</span> Wb.Name = wkbkname <span style="color:#00007f;">Then IsWorkbookOpen = True</span><br />
GoTo exitsub</span></div>
<div><span style="font-family:Courier;"><span style="color:#00007f;">End</span> <span style="color:#00007f;">If</span><br />
<span style="color:#00007f;">Next</span> Wb</span></div>
<div><span style="font-family:Courier;">exitsub:<br />
<span style="color:#00007f;">End</span> <span style="color:#00007f;">Sub</span></span></div>
</div>
<p>Here&#8217;s a IsWorksheetOpen function to check if a worksheet is open or not. Returns TRUE or FALSE</p>
<div id="code"><span style="font-family:Courier;"><span style="color:#00007f;">Public</span> <span style="color:#00007f;">Function</span> IsWorksheetOpen(<span style="color:#00007f;">ByVal</span> wsname <span style="color:#00007f;">As</span> <span style="color:#00007f;">String</span>) <span style="color:#00007f;">As</span> <span style="color:#00007f;">Boolean</span><br />
<span style="color:#00007f;">Dim</span> wk <span style="color:#00007f;">As</span> Worksheet<br />
<span style="color:#00007f;">For</span> <span style="color:#00007f;">Each</span> wk <span style="color:#00007f;">In</span> Worksheets<br />
<span style="color:#00007f;">If</span> wk.Name = wsname <span style="color:#00007f;">Then</span><br />
IsWorksheetOpen = <span style="color:#00007f;">True</span><br />
<span style="color:#00007f;">GoTo</span> exitsub<br />
<span style="color:#00007f;">End</span> <span style="color:#00007f;">If</span><br />
<span style="color:#00007f;">Next</span> wk<br />
exitsub:<br />
<span style="color:#00007f;">End</span> <span style="color:#00007f;">Function</span><br />
</span></div>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2005/02/23/isworksheetopen-and-isworkbookopen-functions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Excel Function to check if text is palindrome or not</title>
		<link>http://nandeshwar.info/2005/02/10/excel-function-to-check-if-text-is-palindrome-or-not/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=excel-function-to-check-if-text-is-palindrome-or-not</link>
		<comments>http://nandeshwar.info/2005/02/10/excel-function-to-check-if-text-is-palindrome-or-not/#comments</comments>
		<pubDate>Thu, 10 Feb 2005 15:16:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[String Operations]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[UDF]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2005/02/10/excel-function-to-check-if-text-is-palindrome-or-not/</guid>
		<description><![CDATA[Definition of palindrome as given in Answers.com pal?in?drome (p?l&#8217;?n-dr?m&#8217;) n. A word, phrase, verse, or sentence that reads the same backward or forward. For example: A man, a plan, a canal, Panama! Function IsPalindrome(sInput As String) As Boolean If sInput = StrReverse(sInput) Then IsPalindrome = True Else IsPalindrome = False End If End Function]]></description>
			<content:encoded><![CDATA[<p>Definition of palindrome as given in <a href="http://www.answers.com">Answers.com</a></p>
<p>pal?in?drome (p?l&#8217;?n-dr?m&#8217;)</p>
<p>n.</p>
<p>A word, phrase, verse, or sentence that reads the same backward or forward. For example: A man, a plan, a canal, Panama!</p>
<p><span style="font-family: Courier;"><span style="color:#00007F">Function</span> IsPalindrome(sInput <span style="color:#00007F">As</span> <span style="color:#00007F">String</span>) <span style="color:#00007F">As</span> <span style="color:#00007F">Boolean</span><br />
<span style="color:#00007F">If</span> sInput = StrReverse(sInput) <span style="color:#00007F">Then</span><br />
IsPalindrome = <span style="color:#00007F">True</span><br />
<span style="color:#00007F">Else</span><br />
IsPalindrome = <span style="color:#00007F">False</span><br />
<span style="color:#00007F">End</span> <span style="color:#00007F">If</span><br />
<span style="color:#00007F">End</span> <span style="color:#00007F">Function</span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2005/02/10/excel-function-to-check-if-text-is-palindrome-or-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

