<?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; excel</title>
	<atom:link href="http://nandeshwar.info/tag/excel/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>Microsoft query in Excel and Case statement</title>
		<link>http://nandeshwar.info/2010/04/15/microsoft-query-in-excel-and-case-statement/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=microsoft-query-in-excel-and-case-statement</link>
		<comments>http://nandeshwar.info/2010/04/15/microsoft-query-in-excel-and-case-statement/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 19:49:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Error messages]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[MS query]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=323</guid>
		<description><![CDATA[It is frustrating that I need to pull the data from SQL server using complex queries and then format it in Excel to &#8221;prettify&#8221; the data. Thankfully, I can use the Microsoft query in Excel to get the data from SQL server and create a table or a PivotTable. Today, I encountered a problem with [...]]]></description>
			<content:encoded><![CDATA[<p>It is frustrating that I need to pull the data from SQL server using complex queries and then format it in Excel to &#8221;prettify&#8221; the data. Thankfully, I can use the Microsoft query in Excel to get the data from SQL server and create a table or a PivotTable. Today, I encountered a problem with the case statement.</p>
<p>Although my syntax was right, MS Query kept throwing exception about the CASE statement. I read some discussions on-line, and some people had the wrong syntax, such as including the alias of the case statement in the group by statement. I did not have that problem. Finally, I found the solution: It was the order by clause. I was using the alias of the case statement in the order by clause. I removed it and the query ran just fine.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2010/04/15/microsoft-query-in-excel-and-case-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My experiments with sparklines</title>
		<link>http://nandeshwar.info/2009/09/23/my-experiments-with-sparklines/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=my-experiments-with-sparklines</link>
		<comments>http://nandeshwar.info/2009/09/23/my-experiments-with-sparklines/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 18:05:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[LaTex]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[sparklines]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=293</guid>
		<description><![CDATA[For the uninitiated, Sparklines are &#8220;data-intense, design-simple, word-sized graphics&#8221; according to its inventor Edward Tufte. I always wanted to include them in my trend reports. The challenge: How and Which tool to use? The data came from this report came from a complex query using SQL server and Access that had this format: College Major [...]]]></description>
			<content:encoded><![CDATA[<p>For the uninitiated, <a title="Sparkline" href="http://en.wikipedia.org/wiki/Sparkline">Sparklines</a> are &#8220;data-intense, design-simple, word-sized graphics&#8221; according to its inventor <a title="Edward Tufte" href="http://en.wikipedia.org/wiki/Edward_Tufte">Edward Tufte</a>. I always wanted to include them in my trend reports. The challenge: How and Which tool to use?</p>
<p>The data came from this report came from a complex query using SQL server and Access that had this format:</p>
<table border="0">
<tbody>
<tr>
<td>College</td>
<td>Major</td>
<td>2005</td>
<td>2006</td>
<td>2007</td>
<td>2008</td>
<td>2009</td>
</tr>
<tr>
<td>A</td>
<td>B</td>
<td>10</td>
<td>15</td>
<td>14</td>
<td>18</td>
<td>25</td>
</tr>
</tbody>
</table>
<p>Some options I investigated and tried (be sure to read <a href="http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0000Lk">this page</a>, you might find many more):</p>
<ul>
<li>Google&#8217;s Chart API (<a href="http://code.google.com/apis/chart/types.html">http://code.google.com/apis/chart/types.html</a>): you can embed these in Google spreadsheets,  create HTML pages using <a href="http://www.cazh1.com/blogger/thoughts/2009/01/hacking-google-chart-api-from-excel.shtml">Excel via VBA</a>, or embed them in<a href="http://www.tushar-mehta.com/publish_train/xl_vba_cases/excel_google_chart_api/index.htm"> Excel sheets</a>. Alas, none would work the way I would like them to work: In-cell graphics</li>
<li> <a href="http://sparklines-excel.blogspot.com/">Use Sparklines for Excel add-in</a>: this add-in will create great in-cell charts (bar, bullet graphs, sparklines, etc), but copying them down is difficult and resource intensive, and any change you make in the column size will alter the shape of that chart. In addition, I had more than 400 rows to populate&#8211;these would be too many objects in a spreadsheet for Excel to handle. My machine froze when I tried to copy it for 10 rows.</li>
<li>Use R&#8217;s implementation by Jason Dieterle (search on <a href="http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0000Lk">this page</a> for Jason Dieterle (email), January 28, 2008. Works very good. I modified the code to print max and mins only, but the function generates a graphic, which needed to be embeded in LaTex file. It did not work nicely. Charts were too big to fit in a cell of a table.</li>
<li>Create bar charts in <a href="http://www.juiceanalytics.com/writing/lightweight-data-exploration-in-excel/">Excel using REPT function</a>. I tried different font sizes and styles, but it didn&#8217;t look pretty, for the range of data varied. (Hint: make the alignment of text 90, use pipe signs, create columns and graphs for each data value, remove gridlines, keep the columns very close. It almost worked.)</li>
<li>Use <a href="http://jblevins.org/projects/spark/">spark</a> package for LaTex, doesn&#8217;t work in pdflatex, and you have to play a lot with the settings</li>
<li>Use <a href="http://www.ctan.org/tex-archive/help/Catalogue/entries/sparklines.html">sparklines </a>package for LaTex. Problem was that data needed to be normalized (or scaled) from 0 to 1, and needed extra parameters for min and max points. Solution: create a normalize function in Excel, and write a big formula to produce the exact needed string for the sparklines to work i.e.:<br />
<code>\begin{sparkline}{5}<br />
\sparkdot 1 1 blue<br />
\sparkdot 0.2 0 red<br />
\spark 0.2 0 0.4 0.0625 0.6 0.5625 0.8 0.75 1 1 /<br />
\end{sparkline}</code></li>
</ul>
<p>Here&#8217;s the normalize function:</p>

<div class="wp_syntax"><div class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Public</span> <span style="color: #000080;">Function</span> Normalize(cell2Normalize <span style="color: #000080;">As</span> Range, WholeRng <span style="color: #000080;">As</span> Range)
       Normalize = (cell2Normalize.Value - WorksheetFunction.Min(WholeRng)) / (WorksheetFunction.Max(WholeRng) - WorksheetFunction.Min(WholeRng))
<span style="color: #000080;">End</span> <span style="color: #000080;">Function</span></pre></div></div>

<p>Here&#8217;s the big formula to convert the range for data values from 2005 to 2009 (in the range E2:I2) to the sparkline LaTex environment.<br />
<code><br />
="\begin{sparkline}{5} " &amp; "\sparkdot " &amp; CHOOSE(MATCH(MAX(E2:I2),E2:I2,0),0.2,0.4,0.6,0.8,1) &amp; " " &amp; 1 &amp; " blue " &amp; "\sparkdot " &amp; CHOOSE(MATCH(MIN(E2:I2),E2:I2,0),0.2,0.4,0.6,0.8,1) &amp; " " &amp; 0 &amp; " red " &amp; " \spark 0.2 " &amp; Normalize(E2,E2:I2) &amp; " 0.4 " &amp; Normalize(F2,E2:I2) &amp; " 0.6 " &amp; Normalize(G2,E2:I2) &amp; " 0.8 " &amp; Normalize(H2,E2:I2) &amp; " 1 " &amp; Normalize(I2,E2:I2) &amp; " / \end{sparkline}"</code></p>
<p>This last option worked beautifully. I dragged the formula down. I selected the data, and clicked on &#8220;Convert Table to LaTex&#8221; button (using this<a href="http://dataninja.wordpress.com/2006/01/20/excel-to-latex/"> add-in</a>). Copied the LaTex code to clipboard and pasted it in my LaTex editor. Manually merged the rows for colleges (using \multirow), and generated a beautiful looking pdf.</p>
<p>I was very happy. Printed it in color. Got a request back very soon that there should be total rows.</p>
<p>I forgot about the sparklines and created a report in Access with plain old numbers in less than 15 mins. Gave it back.</p>
<p>I tried to repeat this &#8211; <a href="http://www.youtube.com/watch?v=EK73YYo0CUk">Sparkline in Cognos</a> -in Access with no luck.</p>
<p>(I later tried it one more time: Got the data in Excel using External data&gt; Access, created a pivottable with rows and all, did some formatting, copied and pasted values and formats, inserted sparkline code, converted it to LaTex, copied and pasted in LaTex editor, and here&#8217;s the beautiful looking <a href="http://nandeshwar.info/wp-content/uploads/2009/09/CollegeEnrSample.pdf">sample pdf</a> of 16)</p>
<p>I wish there were simple reporting solutions that included awesome data visualization tools. (BTW, Excel 2010 will have sparklines: <a href="http://blogs.msdn.com/excel/archive/2009/07/17/sparklines-in-excel.aspx">link</a>) For this report, I did try Sweave, R, and LaTex, but because of the time constraints I could not investigate it further.</p>
<p>Please comment if you know any other way which meet (or don&#8217;t, Tableau is certainly one) these conditions: inexpensive (read free), efficient,  and repeatable.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/09/23/my-experiments-with-sparklines/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Auto Filter Cursor Movement</title>
		<link>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=auto-filter-cursor-movement</link>
		<comments>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 19:09:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[filter]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=250</guid>
		<description><![CDATA[Don&#8217;t you hate it when you are working with many fields and you want to filter a particular field, so you apply auto filter on the all fields, but you find out that the field you were working on is gone from your sight and you see A1 cell. I did. Not anymore. Solution: Simply [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you hate it when you are working with many fields and you want to filter a particular field, so you apply auto filter on the all fields, but you find out that the field you were working on is gone from your sight and you see A1 cell. I did. Not anymore.</p>
<p><strong>Solution</strong>: Simply hit the left or the right arrow key, and it will take you to the left or the right cell of the field you were working on.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/06/01/auto-filter-cursor-movement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Things they didn&#8217;t teach in school</title>
		<link>http://nandeshwar.info/2009/05/22/things-they-didnt-teach-in-school/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=things-they-didnt-teach-in-school</link>
		<comments>http://nandeshwar.info/2009/05/22/things-they-didnt-teach-in-school/#comments</comments>
		<pubDate>Fri, 22 May 2009 19:10:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[LaTex]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=237</guid>
		<description><![CDATA[My gripe about graduate school is that the school focused on well-established software and never embraced nor encouraged open-source software. If they had taught, or at least introduced, these following open-source software, it would have helped us immensely to produce the best looking reports with great data analysis. We, however, had to struggle with SAS/Excel [...]]]></description>
			<content:encoded><![CDATA[<p>My gripe about graduate school is that the school focused on well-established software and never embraced nor encouraged open-source software. If they had taught, or at least introduced, these following open-source software, it would have helped us immensely to produce the best looking reports with great data analysis. We, however, had to struggle with SAS/Excel to get the graphs and analysis needed, and then spend hours to perform formatting in Word. Why they didn&#8217;t teach us:</p>
<ol>
<li>LaTex: a powerful typeset editor, where you focus on writing and not on formatting. It takes care of all the headings, page numbering, figure/table/equation numbering, TOC, bibliography/citation, and more. Although the learning curve is rather steep, once you get the hang of it, life becomes so easy. For windows: you need to get <a href="http://miktex.org/">MikTex</a> and any LaTex editor, such as <a href="http://www.latexeditor.org/">LEd</a>, <a href="http://www.lyx.org/">LyX</a>, or <a href="http://www.winedt.com/">WinEd</a></li>
<li> <a href="http://www.r-project.org/">R</a>: awesome statistical package with wonderful graphics components. Producing stunning graphics and statistics has never been easy. It had me at <span style="color: #ff0000;"><code>summary</code></span>.  Any software that can do produce the following, just by giving <span style="color: #ff0000;"><code>summary(iris)</code></span> command has to be great:</li>
</ol>
<div id="attachment_244" class="wp-caption alignnone" style="width: 387px"><a href="http://nandeshwar.info/wp-content/uploads/2009/05/iris_summary_r.jpg"><img class="size-full wp-image-244" title="iris_summary_r" src="http://nandeshwar.info/wp-content/uploads/2009/05/iris_summary_r.jpg" alt="Summary produced by R of the iris data set" width="377" height="238" /></a><p class="wp-caption-text">Summary produced by R of the iris data set</p></div>
<p>In my thesis, I had plenty of equations, and every time I made some significant changes, MS Word happily would turn those equations into empty white boxes &#8212; and then I had to rewrite them. In retrospect, I find it ridiculous that I was entering citations manually. So every time I added a new reference, I would manually change the bibliography page and the page where I cited that reference. With LaTex, it is just a breeze to do all this.</p>
<p>Descriptive stats, Box-plots, normal curves, neural network, charts with LaTex equations, and a lot of more stuff, all could be easily done using R, and the best part is &#8220;repeatability.&#8221; With simple commands, you could export all the charts as images for various data sets or for various training algorithms. No sweat! Try that with Excel. (I did some years ago).</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/05/22/things-they-didnt-teach-in-school/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access to the VB project is not trusted</title>
		<link>http://nandeshwar.info/2009/04/24/access-to-the-vb-project-is-not-trusted/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=access-to-the-vb-project-is-not-trusted</link>
		<comments>http://nandeshwar.info/2009/04/24/access-to-the-vb-project-is-not-trusted/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 14:42:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Error messages]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://nandeshwar.info/?p=197</guid>
		<description><![CDATA[I was trying to enable an add-in for Excel 2007, and I kept getting this error: Access to the VB project is not trusted You can turn this message off by going to Developer tab in the ribbon and then clicking on the Macro security button, and checking the check box for &#8220;Trust access to [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to enable an add-in for Excel 2007, and I kept getting this error:</p>
<blockquote><p>Access to the VB project is not trusted</p></blockquote>
<p>You can turn this message off by going to Developer tab in the ribbon and then clicking on the Macro security button, and checking the check box for &#8220;Trust access to the VBA project object model.&#8221;</p>
<p>A word of caution: be wary of the add-ins/projects that need VBA access. Don&#8217;t allow any project/add-in with VBA access, unless you know its exact purpose or the author of that project.</p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2009/04/24/access-to-the-vb-project-is-not-trusted/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create Sheets based on a Column</title>
		<link>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-sheets-based-on-a-column</link>
		<comments>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 16:30:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Create Sheets]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[Range Cells]]></category>

		<guid isPermaLink="false">http://a7n9.wordpress.com/2008/11/10/create-sheets-based-on-a-column/</guid>
		<description><![CDATA[Ever felt the need of creating different sheets based on the distinct values of a column. For example, in your data, you have a column called STATE, and you would like to create a separate sheet for each state with all the data from that state. Here&#8217;s your solution then:(Note: you&#8217;ll need to add a [...]]]></description>
			<content:encoded><![CDATA[<p>Ever felt the need of creating different sheets based on the distinct values of a column. For example, in your data, you have a column called STATE, and you would like to create a separate sheet for each state with all the data from that state. Here&#8217;s your solution then:<br />(Note: you&#8217;ll need to add a UDF function UniqueItems from http://j-walk.com/ss/excel/tips/tip15.htm)</p>
<p>This procedure will create a new sheet for each unique item in the selected column with the data from the main sheet for that unique item. As an added bonus, the procedure will sort the sheets ascending (Courtesy:ozgrid.com) <br /><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 : CreateSheetsColumn</span><br /><span style="color:#007F00;">&#8216; DateTime&#160;&#160;: 11/10/2008 09:32</span><br /><span style="color:#007F00;">&#8216; Author&#160;&#160;&#160;&#160;: ARN</span><br /><span style="color:#007F00;">&#8216; Purpose&#160;&#160; : To create sheets with the data from the main sheet based on a selected column.</span><br /><span style="color:#007F00;">&#8216;Assumptions:</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;1 -&#160;&#160;data are in contigious form</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;2 &#8211; the unique column does not have any special characters</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;3 &#8211; the first row is the header row</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8217;4 &#8211; the only sheet in the workbook is the data workbook</span><br /><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;</span><br /><span style="color:#00007F;">Public</span> <span style="color:#00007F;">Sub</span> CreateSheetsColumn()</p>
<p><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> CreateSheetsColumn_Error<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> rngInput <span style="color:#00007F;">As</span> Range, rngColAddr <span style="color:#00007F;">As</span> Range, varrUniqueVals() <span style="color:#00007F;">As</span> <span style="color:#00007F;">Variant</span>, dCounter <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> rngCol <span style="color:#00007F;">As</span> Range<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> dUniqueItems <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span>, dColtoFilterOn <span style="color:#00007F;">As</span> <span style="color:#00007F;">Double</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Dim</span> lCount <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lShtLast <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span>, lCount2 <span style="color:#00007F;">As</span> <span style="color:#00007F;">Long</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;Set the working range</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Set</span> rngInput = ActiveSheet.Range(Cells(1, 1), Cells(1, 1).SpecialCells(xlLastCell))<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;get the column to work on from the user</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Set</span> rngColAddr = Application.InputBox(prompt:=&#8221;Select the column that would be used to create distinct sheets&#8221;, _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Title:=&#8221;Select a Column&#8221;, _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Type:=8)<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;if more than one column is selected, exit</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> rngColAddr.Columns.Count &gt; 1 <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MsgBox &#8220;Too many columns; select only one column&#8221;, vbOKOnly<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">End</span> <span style="color:#00007F;">If</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;set the application screen updating to false to increase execution speed</span><br />&#160;&#160;&#160;&#160;Application.ScreenUpdating = <span style="color:#00007F;">False</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;store the column number in a variable</span><br />&#160;&#160;&#160;&#160;dColtoFilterOn = rngColAddr.Column<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;set a range from the 2nd row to the last row from the selected column to get the distinct values</span><br />&#160;&#160;&#160;&#160;Set rngCol = ActiveSheet.Range(Cells(2, dColtoFilterOn), Cells(rngInput.Rows.Count, dColtoFilterOn))<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;use the function UniqueItems (http://j-walk.com/ss/excel/tips/tip15.htm) to get unique values from the selected column</span><br />&#160;&#160;&#160;&#160;varrUniqueVals = UniqueItems(rngCol, <span style="color:#00007F;">False</span>)<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;get the total number of unique items</span><br />&#160;&#160;&#160;&#160;dUniqueItems = <span style="color:#00007F;">UBound</span>(varrUniqueVals, 1)<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;start a loop to filter the range on each unique item</span><br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> dCounter = 1 <span style="color:#00007F;">To</span> dUniqueItems<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; only if the unique value is not blank</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> <span style="color:#00007F;">Not</span> varrUniqueVals(dCounter) = &#8220;&#8221; <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; apply filter</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rngInput.AutoFilter Field:=dColtoFilterOn, Criteria1:=varrUniqueVals(dCounter)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;add a new sheet</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Sheets.Add After:=Sheets(Sheets.Count)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;rename the sheet</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ActiveSheet.Name = varrUniqueVals(dCounter)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;"<br />
>&#8216;copy the filtered data</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;rngInput.Copy Destination:=Worksheets(varrUniqueVals(dCounter)).Range(&#8220;A1&#8243;)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;remove copy</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Application.CutCopyMode = <span style="color:#00007F;">False</span><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> dCounter<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216;remove filter</span><br />&#160;&#160;&#160;&#160;rngInput.AutoFilter<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; Sort sheets ascending &#8211; except the first one</span><br />&#160;&#160;&#160;&#160;<span style="color:#007F00;">&#8216; copied from http://www.ozgrid.com/VBA/sort-sheets.htm</span><br />&#160;&#160;&#160;&#160;<br />&#160;&#160;&#160;&#160;lShtLast = Sheets.Count<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> lCount = 2 <span style="color:#00007F;">To</span> lShtLast<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">For</span> lCount2 = lCount <span style="color:#00007F;">To</span> lShtLast<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">If</span> UCase(Sheets(lCount2).Name) &lt; UCase(Sheets(lCount).Name) <span style="color:#00007F;">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Sheets(lCount2).Move Before:=Sheets(lCount)<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#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;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> lCount2<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#00007F;">Next</span> lCount<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />MsgBox &#8220;Done&#8221;</p>
<p><span style="color:#00007F;">On</span> <span style="color:#00007F;">Error</span> <span style="color:#00007F;">GoTo</span> 0<br />SmoothExit_CreateSheetsColumn:</p>
<p>&#160;&#160;&#160;&#160;Application.ScreenUpdating = <span style="color:#00007F;">True</span></p>
<p>&#160;&#160;&#160;&#160;<span style="color:#00007F;">Exit</span> <span style="color:#00007F;">Sub</span></p>
<p>CreateSheetsColumn_Error:<br />&#160;&#160;&#160;&#160;MsgBox &#8220;Error &#8221; &amp; Err.Number &amp; &#8221; (&#8221; &amp; Err.Description &amp; &#8220;) in Sub:CreateSheetsColumn&#8221;<br />&#160;&#160;&#160;&#160;<span style="color:#00007F;">Resume</span> SmoothExit_CreateSheetsColumn<br /><span style="color:#00007F;">End</span> <span style="color:#00007F;">Sub</span><br /></font></p>
]]></content:encoded>
			<wfw:commentRss>http://nandeshwar.info/2008/11/10/create-sheets-based-on-a-column/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>
	</channel>
</rss>

