<?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>asap utilities / excel blog &#187; Functions</title>
	<atom:link href="http://www.asap-utilities.com/blog/index.php/category/functions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.asap-utilities.com/blog</link>
	<description>Supercharge Excel</description>
	<lastBuildDate>Wed, 25 Jan 2012 10:53:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Round up formulas with =ROUND()</title>
		<link>http://www.asap-utilities.com/blog/index.php/2005/12/06/round-up-formulas-with-round/</link>
		<comments>http://www.asap-utilities.com/blog/index.php/2005/12/06/round-up-formulas-with-round/#comments</comments>
		<pubDate>Tue, 06 Dec 2005 10:04:00 +0000</pubDate>
		<dc:creator>Bastien</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.asap-utilities.com/blog/?p=30</guid>
		<description><![CDATA[I just got a call from a friend of mine. He needed to edit a spreadsheet and round a bunch of formulas. Since the rounding is important for the calculations, a simple cell-formatting wouldn't do. Excel's worksheet function =ROUND() can be used to round the numbers. However editing a lot of cells by hand (especially [...]]]></description>
			<content:encoded><![CDATA[I just got a call from a friend of mine. He needed to edit a spreadsheet and round a bunch of formulas. Since the rounding is important for the calculations, a simple cell-formatting wouldn't do.<br />
Excel's worksheet function =ROUND() can be used to round the numbers. However editing a lot of cells by hand (especially with a lot of different formulas that can't be copied) can be time consuming. So I wrote a little routine for it he can use the next time:<br />
<br />
<img src='http://www.asap-utilities.com/blog/wp-content/build_round_formula.gif' alt='' style='margin-bottom:4px;margin-top:4px'/>
<br />
<div class="code"><br /><span style="color:blue">Sub</span> BuildRoundFormula()<br />&#160;&#160;<span style="color:#007F00">&#039; Build the =ROUND() function around the formulas</span><br />&#160;&#160;<span style="color:#007F00">&#039; in your selection</span><br /><br />&#160;&#160;<span style="color:blue">Dim</span> rngCel&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue">As</span> Range<br />&#160;&#160;<span style="color:blue">Dim</span> strFormula&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue">As</span> <span style="color:blue">String</span><br />&#160;&#160;<span style="color:blue">Dim</span> lNumDigits&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:blue">As</span> <span style="color:blue">Long</span><br />&#160;&#160;lNumDigits = 2&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00">&#039; < --- EDIT THIS</SPAN><br /><br />&#160;&#160;</span><span style="color:#007F00">&#039; If lNumDigits is greater than 0 (zero), then number</span><br />&#160;&#160;<span style="color:#007F00">&#039; is rounded to the specified number of decimal places.</span><br />&#160;&#160;<span style="color:#007F00">&#039; If lNumDigits is 0, then number is rounded to the</span><br />&#160;&#160;<span style="color:#007F00">&#039; nearest integer.</span><br />&#160;&#160;<span style="color:#007F00">&#039; If lNumDigits is less than 0, then number is rounded</span><br />&#160;&#160;<span style="color:#007F00">&#039; to the left of the decimal point.</span><br /><br />&#160;&#160;<span style="color:blue">For</span> <span style="color:blue">Each</span> rngCel <span style="color:blue">In</span> Selection<br />&#160;&#160;&#160;&#160;<span style="color:blue">If</span> rngCel.HasFormula <span style="color:blue">Then</span><br />&#160;&#160;&#160;&#160;&#160;&#160;strFormula = rngCel.Formula<br />&#160;&#160;&#160;&#160;&#160;&#160;<span style="color:#007F00">&#039; strip the equal sign on the left:</span><br />&#160;&#160;&#160;&#160;&#160;&#160;strFormula = Right(strFormula, Len(strFormula) - 1)<br />&#160;&#160;&#160;&#160;&#160;&#160;rngCel.Formula = "=ROUND((" &#038; strFormula &#038; ")," &#038; _<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; lNumDigits &#038; ")"<br />&#160;&#160;&#160;&#160;<span style="color:blue">End</span> <span style="color:blue">If</span><br />&#160;&#160;<span style="color:blue">Next</span><br /><span style="color:blue">End</span> <span style="color:blue">Sub</span><br />
</div>
<br />
By changing the value of the variable lNumDigits you can specify the number of decimals or digits.<br />
If you're a little handy with macro's you can use this procedure as a start to apply other functions.]]></content:encoded>
			<wfw:commentRss>http://www.asap-utilities.com/blog/index.php/2005/12/06/round-up-formulas-with-round/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

