<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Formula Tokenizer</title>
	<atom:link href="http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:28:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Rob van Gelder</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-59290</link>
		<dc:creator>Rob van Gelder</dc:creator>
		<pubDate>Wed, 16 Feb 2011 19:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-59290</guid>
		<description>&lt;p&gt;Hi Ben.&lt;/p&gt;
&lt;p&gt;Thanks for identifying the bug!&lt;br&gt;
That wasn&#039;t very clever of me - naturally it would memory leak.&lt;/p&gt;
&lt;p&gt;There is a way around it, as commented by Rob Bruce &lt;a href=&quot;http://www.dailydoseofexcel.com/archives/2007/12/28/terminating-dependent-classes/#comment-29661&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cheers&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Ben.</p>
<p>Thanks for identifying the bug!<br />
That wasn&#8217;t very clever of me &#8211; naturally it would memory leak.</p>
<p>There is a way around it, as commented by Rob Bruce <a href="http://www.dailydoseofexcel.com/archives/2007/12/28/terminating-dependent-classes/#comment-29661" rel="nofollow">here</a>.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Norris</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-59273</link>
		<dc:creator>Ben Norris</dc:creator>
		<pubDate>Wed, 16 Feb 2011 13:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-59273</guid>
		<description>&lt;p&gt;Ok, so I&#039;ve found the issue and it is pretty much as described on the link above. The Class &#039;Token&#039; contains a Public member called &#039;Parent&#039; that is of type Class Tokens, thus creating the circularity described in the above article.&lt;/p&gt;
&lt;p&gt;If you remove this member (and all references to it elsewhere in the code) then the memory issue is resolved. Note that in my application I have removed all of the code relating to the example form Rob included so the &#039;Parent&#039; member is actually redundant anyway.&lt;/p&gt;
&lt;p&gt;I&#039;ve also added code at the end of the main ParseFormula procedure to set all local objects to Nothing, as well as code to do the same upon class_terminate for each of the classes.&lt;/p&gt;
&lt;p&gt;Hope someone finds the above useful!&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Ok, so I&#8217;ve found the issue and it is pretty much as described on the link above. The Class &#8216;Token&#8217; contains a Public member called &#8216;Parent&#8217; that is of type Class Tokens, thus creating the circularity described in the above article.</p>
<p>If you remove this member (and all references to it elsewhere in the code) then the memory issue is resolved. Note that in my application I have removed all of the code relating to the example form Rob included so the &#8216;Parent&#8217; member is actually redundant anyway.</p>
<p>I&#8217;ve also added code at the end of the main ParseFormula procedure to set all local objects to Nothing, as well as code to do the same upon class_terminate for each of the classes.</p>
<p>Hope someone finds the above useful!</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Norris</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-59270</link>
		<dc:creator>Ben Norris</dc:creator>
		<pubDate>Wed, 16 Feb 2011 12:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-59270</guid>
		<description>&lt;p&gt;Just found the following and wonder if it might have something to do with it:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.vbi.org/Items/article.asp?id=106&quot; rel=&quot;nofollow&quot;&gt;http://www.vbi.org/Items/article.asp?id=106&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Will have a look at the tokeniser code and see if it falls into that trap. My gut feel is that it does...&lt;/p&gt;
&lt;p&gt;Rgds,&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Just found the following and wonder if it might have something to do with it:</p>
<p><a href="http://www.vbi.org/Items/article.asp?id=106" rel="nofollow">http://www.vbi.org/Items/article.asp?id=106</a></p>
<p>Will have a look at the tokeniser code and see if it falls into that trap. My gut feel is that it does&#8230;</p>
<p>Rgds,</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Norris</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-59217</link>
		<dc:creator>Ben Norris</dc:creator>
		<pubDate>Tue, 15 Feb 2011 17:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-59217</guid>
		<description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;I&#039;ve started using the tokeniser code in anger recently and noticed an &#039;interesting&#039; memory issue that I can&#039;t seem to resolve...&lt;/p&gt;
&lt;p&gt;If you add a sheet to the Parser.xls file with about 40,000 formulae on it (just to give you something to work with) and run the tokeniser on each cell in turn then the memory used by Excel shoots up dramatically (an increase of over 120MB once all cells are processed). FYI I&#039;m running Excel 2010 and the test code I ran looks like this:&lt;/p&gt;
&lt;div style=&quot;overflow: auto; white-space: nowrap;&quot; class=&quot;codecolorer-container vb default&quot;&gt;&lt;div style=&quot;white-space: nowrap;&quot; class=&quot;vb codecolorer&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; test()&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; rngT &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Range&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; tknT &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; Tokens&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Each&lt;/span&gt; rngT &lt;span class=&quot;kw1&quot;&gt;In&lt;/span&gt; Sheet23.UsedRange&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt; Left(rngT.Formula, 1) = &lt;span class=&quot;st0&quot;&gt;&quot;=&quot;&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Then&lt;/span&gt;&lt;br&gt;
&#160; &#160; &#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; tknT = ParseFormula(rngT.Formula)&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;If&lt;/span&gt;&lt;br&gt;
&#160; &#160; &lt;span class=&quot;kw1&quot;&gt;Set&lt;/span&gt; tknT = &lt;span class=&quot;kw1&quot;&gt;Nothing&lt;/span&gt;&lt;br&gt;
&#160; &#160; DoEvents&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;Next&lt;/span&gt; rngT&lt;br&gt;
&lt;br&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;As you can see I&#039;m killing the tknT variable after each call of ParseFormula and as such wouldn&#039;t expect the memory to rise as much as it is. The other odd thing is that once the code has completed running, if you click on the &#039;Reset&#039; button in the VBE (looks like a Stop button next to the Play and Pause buttons) Excel seems to release all the memory that it has stored up (it takes a while for it to do this though and Excel hangs whilst doing it).&lt;/p&gt;
&lt;p&gt;I can&#039;t seem to see any global variables that are used in the Tokeniser so am really at a loss to understand what&#039;s going on. Any ideas?!&lt;/p&gt;
&lt;p&gt;Many thanks,&lt;/p&gt;
&lt;p&gt;Ben.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Rob,</p>
<p>I&#8217;ve started using the tokeniser code in anger recently and noticed an &#8216;interesting&#8217; memory issue that I can&#8217;t seem to resolve&#8230;</p>
<p>If you add a sheet to the Parser.xls file with about 40,000 formulae on it (just to give you something to work with) and run the tokeniser on each cell in turn then the memory used by Excel shoots up dramatically (an increase of over 120MB once all cells are processed). FYI I&#8217;m running Excel 2010 and the test code I ran looks like this:</p>
<div style="overflow: auto; white-space: nowrap;" class="codecolorer-container vb default">
<div style="white-space: nowrap;" class="vb codecolorer"><span class="kw1">Sub</span> test()</p>
<p><span class="kw1">Dim</span> rngT <span class="kw1">As</span> Range<br />
<span class="kw1">Dim</span> tknT <span class="kw1">As</span> Tokens</p>
<p><span class="kw1">For</span> <span class="kw1">Each</span> rngT <span class="kw1">In</span> Sheet23.UsedRange<br />
&nbsp; &nbsp; <span class="kw1">If</span> Left(rngT.Formula, 1) = <span class="st0">&#8220;=&#8221;</span> <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">Set</span> tknT = ParseFormula(rngT.Formula)<br />
&nbsp; &nbsp; <span class="kw1">End</span> <span class="kw1">If</span><br />
&nbsp; &nbsp; <span class="kw1">Set</span> tknT = <span class="kw1">Nothing</span><br />
&nbsp; &nbsp; DoEvents<br />
<span class="kw1">Next</span> rngT</p>
<p><span class="kw1">End</span> <span class="kw1">Sub</span></div>
</div>
<p>As you can see I&#8217;m killing the tknT variable after each call of ParseFormula and as such wouldn&#8217;t expect the memory to rise as much as it is. The other odd thing is that once the code has completed running, if you click on the &#8216;Reset&#8217; button in the VBE (looks like a Stop button next to the Play and Pause buttons) Excel seems to release all the memory that it has stored up (it takes a while for it to do this though and Excel hangs whilst doing it).</p>
<p>I can&#8217;t seem to see any global variables that are used in the Tokeniser so am really at a loss to understand what&#8217;s going on. Any ideas?!</p>
<p>Many thanks,</p>
<p>Ben.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob van Gelder</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-47594</link>
		<dc:creator>Rob van Gelder</dc:creator>
		<pubDate>Sun, 04 Jul 2010 10:33:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-47594</guid>
		<description>&lt;p&gt;A bit late in replying, sorry.&lt;/p&gt;
&lt;p&gt;Ben: I decided not to go as far as distinguishing between cell references and named references. I don&#039;t think it would be too hard to work out, but there&#039;s the added problem of 2007 versus 2003 names.&lt;br&gt;
In 2003 ABC123 is a name, but in 2007 it&#039;s a cell.&lt;/p&gt;
&lt;p&gt;Chris: pleased it&#039;s of use to someone. cheers&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>A bit late in replying, sorry.</p>
<p>Ben: I decided not to go as far as distinguishing between cell references and named references. I don&#8217;t think it would be too hard to work out, but there&#8217;s the added problem of 2007 versus 2003 names.<br />
In 2003 ABC123 is a name, but in 2007 it&#8217;s a cell.</p>
<p>Chris: pleased it&#8217;s of use to someone. cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Greaves</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-45821</link>
		<dc:creator>Chris Greaves</dc:creator>
		<pubDate>Tue, 04 May 2010 11:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-45821</guid>
		<description>&lt;p&gt;&quot;Now that I&#039;m finished, I&#039;m sharing...&quot;&lt;br&gt;
Thanks Rob.&lt;br&gt;
I started using BN back in the early seventies, but have been away for a while.&lt;br&gt;
I felt a need to write a formula parser, and you popped up in a search.&lt;br&gt;
Your comment above reminds me of the spirit back in the days of 80-column punched cards ....&lt;/p&gt;
&lt;p&gt;Here you are: Enjoy a free copy of the indexer!&lt;br&gt;
&lt;a href=&quot;http://www.Indxr.ca&quot; rel=&quot;nofollow&quot;&gt;http://www.Indxr.ca&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>&#8220;Now that I&#8217;m finished, I&#8217;m sharing&#8230;&#8221;<br />
Thanks Rob.<br />
I started using BN back in the early seventies, but have been away for a while.<br />
I felt a need to write a formula parser, and you popped up in a search.<br />
Your comment above reminds me of the spirit back in the days of 80-column punched cards &#8230;.</p>
<p>Here you are: Enjoy a free copy of the indexer!<br />
<a href="http://www.Indxr.ca" rel="nofollow">http://www.Indxr.ca</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Norris</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-45475</link>
		<dc:creator>Ben Norris</dc:creator>
		<pubDate>Fri, 23 Apr 2010 16:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-45475</guid>
		<description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;I&#039;ve recently been playing around with your original tokeniser (from AudXL) and have found it to be excellently written, fast and very useful. I&#039;ve only just found this article where you introduce the new version. To be honest, I&#039;ve not really used the original code in XL2007 much so hadn&#039;t noticed any issues with it in that respect, but am keen to use the new code as I&#039;ll doubtless be using XL2007/2010 more going forward.&lt;/p&gt;
&lt;p&gt;Two quick points:&lt;/p&gt;
&lt;p&gt;1. In the original version, the parser incorrectly recognised a cell with the text &quot;Unit(s)&quot; in it (note: not entered as a formula, just as a text label) as a function called Unit. This was pretty easy to fix but I thought you might like to be aware of it. I don&#039;t think the new version has the same problem. It happens with any text with an open bracket after it.&lt;/p&gt;
&lt;p&gt;2. In the old version you had a specific token type for &#039;Operand Reference Named Range&#039; which seems to have gone from the new version - both cell references and named ranges are returned as token type &#039;Reference&#039;. I quite liked having the ability to distinguish between a reference to a cell and a reference to a named range so I was thinking of adding some code to do this. In your original tokeniser you wrote a function called &#039;IsReferenceA1&#039; to check if a reference was to a cell or to a named range and I was thinking of re-writing this for XL2007 (to take account of the Big Grid). Before I do that I was wondering if you&#039;d already tried that and abandoned it as not being possible, or if there was some other reason you left it out.&lt;/p&gt;
&lt;p&gt;Many thanks for offering this great code to the community - it&#039;s been hugely inspiring, educational and useful!&lt;/p&gt;
&lt;p&gt;Rgds,&lt;/p&gt;
&lt;p&gt;Ben&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Rob,</p>
<p>I&#8217;ve recently been playing around with your original tokeniser (from AudXL) and have found it to be excellently written, fast and very useful. I&#8217;ve only just found this article where you introduce the new version. To be honest, I&#8217;ve not really used the original code in XL2007 much so hadn&#8217;t noticed any issues with it in that respect, but am keen to use the new code as I&#8217;ll doubtless be using XL2007/2010 more going forward.</p>
<p>Two quick points:</p>
<p>1. In the original version, the parser incorrectly recognised a cell with the text &#8220;Unit(s)&#8221; in it (note: not entered as a formula, just as a text label) as a function called Unit. This was pretty easy to fix but I thought you might like to be aware of it. I don&#8217;t think the new version has the same problem. It happens with any text with an open bracket after it.</p>
<p>2. In the old version you had a specific token type for &#8216;Operand Reference Named Range&#8217; which seems to have gone from the new version &#8211; both cell references and named ranges are returned as token type &#8216;Reference&#8217;. I quite liked having the ability to distinguish between a reference to a cell and a reference to a named range so I was thinking of adding some code to do this. In your original tokeniser you wrote a function called &#8216;IsReferenceA1&#8242; to check if a reference was to a cell or to a named range and I was thinking of re-writing this for XL2007 (to take account of the Big Grid). Before I do that I was wondering if you&#8217;d already tried that and abandoned it as not being possible, or if there was some other reason you left it out.</p>
<p>Many thanks for offering this great code to the community &#8211; it&#8217;s been hugely inspiring, educational and useful!</p>
<p>Rgds,</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob van Gelder</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-42690</link>
		<dc:creator>Rob van Gelder</dc:creator>
		<pubDate>Wed, 09 Dec 2009 19:11:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-42690</guid>
		<description>&lt;p&gt;Sorry, I&#039;m better at Excel than at making webpages!&lt;br&gt;
Kanwaljit&#039;s link is what you want. That was the last version I made.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry, I&#8217;m better at Excel than at making webpages!<br />
Kanwaljit&#8217;s link is what you want. That was the last version I made.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Conrad Brits</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-42680</link>
		<dc:creator>Conrad Brits</dc:creator>
		<pubDate>Wed, 09 Dec 2009 14:58:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-42680</guid>
		<description>&lt;p&gt;Rob, that is the link that I used but, when clicking through, it changed to &lt;a href=&quot;http://vangelder.orconhosting.net.nz/excel/&quot; rel=&quot;nofollow&quot;&gt;http://vangelder.orconhosting.net.nz/excel/&lt;/a&gt; with a Google Trivia link and the rest of the page being blank. Something I&#039;m doing wrong here or a setting in IE on my PC?&lt;br&gt;
The link Kanwaljit has did work though.&lt;br&gt;
Regards.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Rob, that is the link that I used but, when clicking through, it changed to <a href="http://vangelder.orconhosting.net.nz/excel/" rel="nofollow">http://vangelder.orconhosting.net.nz/excel/</a> with a Google Trivia link and the rest of the page being blank. Something I&#8217;m doing wrong here or a setting in IE on my PC?<br />
The link Kanwaljit has did work though.<br />
Regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kanwaljit</title>
		<link>http://www.dailydoseofexcel.com/archives/2009/12/05/formula-tokenizer/#comment-42666</link>
		<dc:creator>Kanwaljit</dc:creator>
		<pubDate>Wed, 09 Dec 2009 07:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=3324#comment-42666</guid>
		<description>&lt;p&gt;Rob,&lt;br&gt;
But I found it at the following link. Is there any update after that ?&lt;br&gt;
&lt;a href=&quot;http://vangelder.orconhosting.net.nz/excel/audxl.html&quot; rel=&quot;nofollow&quot;&gt;http://vangelder.orconhosting.net.nz/excel/audxl.html&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Rob,<br />
But I found it at the following link. Is there any update after that ?<br />
<a href="http://vangelder.orconhosting.net.nz/excel/audxl.html" rel="nofollow">http://vangelder.orconhosting.net.nz/excel/audxl.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

