<?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: Find Matching Data in Array Speed Test</title>
	<atom:link href="http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/feed/" rel="self" type="application/rss+xml" />
	<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/</link>
	<description>Daily posts of Excel tips…and other stuff</description>
	<lastBuildDate>Wed, 22 May 2013 22:14:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Slow inner loop many to many matching</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-86309</link>
		<dc:creator>Slow inner loop many to many matching</dc:creator>
		<pubDate>Fri, 12 Oct 2012 08:10:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-86309</guid>
		<description><![CDATA[[...]  [...]]]></description>
		<content:encoded><![CDATA[<p>[...]  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85858</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Thu, 13 Sep 2012 16:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85858</guid>
		<description><![CDATA[@snb,

Thanks for running the test! I figured it would be slower than yours, but I thought it might have been a little closer than that though. Just out of curiosity, did you try running your code without using the Filter function? InStr is fast, so I wonder if Join&#039;ing the entire array rather than Filter&#039;ing the array and Join&#039;ing what results might be faster.

Function IsInArray_snb(sn As Variant, c01 As String) As Boolean
  IsInArray_snb = InStr(&quot;_&quot; &amp; Join(sn, &quot;_&quot;) &amp; &quot;_&quot;, &quot;_&quot; &amp; c01 &amp; &quot;_&quot;)
End Function

Note: I left out the Optional c02 argument since your original code, as well as this one, never make use of it.]]></description>
		<content:encoded><![CDATA[<p>@snb,</p>
<p>Thanks for running the test! I figured it would be slower than yours, but I thought it might have been a little closer than that though. Just out of curiosity, did you try running your code without using the Filter function? InStr is fast, so I wonder if Join&#8217;ing the entire array rather than Filter&#8217;ing the array and Join&#8217;ing what results might be faster.</p>
<p>Function IsInArray_snb(sn As Variant, c01 As String) As Boolean<br />
  IsInArray_snb = InStr(&#8220;_&#8221; &amp; Join(sn, &#8220;_&#8221;) &amp; &#8220;_&#8221;, &#8220;_&#8221; &amp; c01 &amp; &#8220;_&#8221;)<br />
End Function</p>
<p>Note: I left out the Optional c02 argument since your original code, as well as this one, never make use of it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: snb</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85855</link>
		<dc:creator>snb</dc:creator>
		<pubDate>Thu, 13 Sep 2012 13:50:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85855</guid>
		<description><![CDATA[@Rick

on my system it takes approx. 40 % more time than my method does, but it is faster than DK&#039;s &amp; JP&#039;s method.]]></description>
		<content:encoded><![CDATA[<p>@Rick</p>
<p>on my system it takes approx. 40 % more time than my method does, but it is faster than DK&#8217;s &amp; JP&#8217;s method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick Rothstein (MVP - Excel)</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85852</link>
		<dc:creator>Rick Rothstein (MVP - Excel)</dc:creator>
		<pubDate>Thu, 13 Sep 2012 04:33:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85852</guid>
		<description><![CDATA[Just a guess, but this is probably not as fast as snb&#039;s one-liner, but I thought I would put it out there in case someone wanted to test it...

Function IsInArray_Rick(vArr As Variant, S As String) As Boolean
  IsInArray_Rick = UBound(Split(Chr$(1) &amp; Join(vArr, Chr$(1)) &amp; Chr$(1), Chr$(1) &amp; S &amp; Chr$(1), 2))
End Function]]></description>
		<content:encoded><![CDATA[<p>Just a guess, but this is probably not as fast as snb&#8217;s one-liner, but I thought I would put it out there in case someone wanted to test it&#8230;</p>
<p>Function IsInArray_Rick(vArr As Variant, S As String) As Boolean<br />
  IsInArray_Rick = UBound(Split(Chr$(1) &amp; Join(vArr, Chr$(1)) &amp; Chr$(1), Chr$(1) &amp; S &amp; Chr$(1), 2))<br />
End Function</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: snb</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85839</link>
		<dc:creator>snb</dc:creator>
		<pubDate>Wed, 12 Sep 2012 14:55:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85839</guid>
		<description><![CDATA[Highly improbable when using:

&lt;code lang=&quot;VB&quot;&gt;
   IsInArray_snb = InStr(Chr(0) &amp; Join(Filter(sn, c01), Chr(0)) &amp; Chr(0), Chr(0) &amp; c01 &amp; Chr(0))
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>Highly improbable when using:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;IsInArray_snb = InStr(Chr(0) &amp; Join(Filter(sn, c01), Chr(0)) &amp; Chr(0), Chr(0) &amp; c01 &amp; Chr(0))</div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85808</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Mon, 10 Sep 2012 19:57:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85808</guid>
		<description><![CDATA[@snb

Clever, but I prefer StrComp to get an exact match. Your function will return True for a substring match where one of the array elements contains an underscore. ex:

[cc lang=&#039;vb&#039;]IsInArray_snb(Array(&quot;ID_12345&quot;, &quot;ID_23432&quot;, &quot;orange&quot;), &quot;ID&quot;)[/cc]]]></description>
		<content:encoded><![CDATA[<p>@snb</p>
<p>Clever, but I prefer StrComp to get an exact match. Your function will return True for a substring match where one of the array elements contains an underscore. ex:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">IsInArray_snb(Array(<span style="color: #800000;">&quot;ID_12345&quot;</span>, <span style="color: #800000;">&quot;ID_23432&quot;</span>, <span style="color: #800000;">&quot;orange&quot;</span>), <span style="color: #800000;">&quot;ID&quot;</span>)</div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: snb</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85744</link>
		<dc:creator>snb</dc:creator>
		<pubDate>Fri, 07 Sep 2012 07:42:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85744</guid>
		<description><![CDATA[I tested another method, using an ActiveX control.
Instead of searching in an array, you can look into the array that has heen assigned to a combobox or listbox.

So in Dick&#039;s macro &#039;testarray&#039;, after filling the array aNames() I assigned that array to
Sheet1.Combobox1.List
or
Sheet1.Listbox1.List

Now the IsInArrray function can have the following structure

&lt;code lang=&quot;vb&quot;&gt;Function IsInArray_snb(c01 As String) As Boolean
   With Sheet1.ComboBox1
       .Value = c01
        IsInArray_snb = .ListIndex &gt; -1
   End With
End Function&lt;/code&gt;

I&#039;m not very disappointed by it&#039;s speed.]]></description>
		<content:encoded><![CDATA[<p>I tested another method, using an ActiveX control.<br />
Instead of searching in an array, you can look into the array that has heen assigned to a combobox or listbox.</p>
<p>So in Dick&#8217;s macro &#8216;testarray&#8217;, after filling the array aNames() I assigned that array to<br />
Sheet1.Combobox1.List<br />
or<br />
Sheet1.Listbox1.List</p>
<p>Now the IsInArrray function can have the following structure</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #E56717; font-weight: bold;">Function</span> IsInArray_snb(c01 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Boolean</span><br />
&nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">With</span> Sheet1.ComboBox1<br />
&nbsp; &nbsp; &nbsp; &nbsp;.Value = c01<br />
&nbsp; &nbsp; &nbsp; &nbsp; IsInArray_snb = .ListIndex &gt; -1<br />
&nbsp; &nbsp;<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">With</span><br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span></div></div>
<p>I&#8217;m not very disappointed by it&#8217;s speed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: snb</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85712</link>
		<dc:creator>snb</dc:creator>
		<pubDate>Thu, 06 Sep 2012 13:11:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85712</guid>
		<description><![CDATA[I left a wrong email address.
So I corrected it.

The results of this function were half the time IsInArray_JP of IsInArray_DK produced.

&lt;code lang=&quot;vb&quot;&gt;Function IsInArray_snb(sn As Variant, c01 As String, Optional c02 As Boolean = True) As Boolean
IsInArray_snb = InStr(“_” &amp; Join(Filter(sn, c01), “_”) &amp; “_”, “_” &amp; c01 &amp; “_”)
End Function,&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>I left a wrong email address.<br />
So I corrected it.</p>
<p>The results of this function were half the time IsInArray_JP of IsInArray_DK produced.</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #E56717; font-weight: bold;">Function</span> IsInArray_snb(sn <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Variant</span>, c01 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">String</span>, <span style="color: #151B8D; font-weight: bold;">Optional</span> c02 <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Boolean</span> = <span style="color: #00C2FF; font-weight: bold;">True</span>) <span style="color: #151B8D; font-weight: bold;">As</span> <span style="color: #F660AB; font-weight: bold;">Boolean</span><br />
IsInArray_snb = InStr(“_” &amp; Join(Filter(sn, c01), “_”) &amp; “_”, “_” &amp; c01 &amp; “_”)<br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Function</span>,</div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: snb</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-85675</link>
		<dc:creator>snb</dc:creator>
		<pubDate>Wed, 05 Sep 2012 13:17:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-85675</guid>
		<description><![CDATA[The results of this function were half the time IsInArray_JP of IsInArray_DK produced.

&lt;code&gt;Function IsInArray_snb(sn As Variant, c01 As String, Optional c02 As Boolean = True) As Boolean
   IsInArray_snb = InStr(&quot;_&quot; &amp; Join(Filter(sn, c01), &quot;_&quot;) &amp; &quot;_&quot;, &quot;_&quot; &amp; c01 &amp; &quot;_&quot;)
End Function&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p>The results of this function were half the time IsInArray_JP of IsInArray_DK produced.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Function IsInArray_snb(sn As Variant, c01 As String, Optional c02 As Boolean = True) As Boolean<br />
&nbsp; &nbsp;IsInArray_snb = InStr(&quot;_&quot; &amp; Join(Filter(sn, c01), &quot;_&quot;) &amp; &quot;_&quot;, &quot;_&quot; &amp; c01 &amp; &quot;_&quot;)<br />
End Function</div></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kyle</title>
		<link>http://dailydoseofexcel.com/archives/2012/07/03/find-matching-data-in-array-speed-test/#comment-84384</link>
		<dc:creator>Kyle</dc:creator>
		<pubDate>Tue, 24 Jul 2012 10:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.dailydoseofexcel.com/?p=7149#comment-84384</guid>
		<description><![CDATA[Really interesting post, there is also another method that hasn&#039;t been mentioned. Recently I&#039;ve been playing with the System.Collection classes from .Net that are usable from Excel - in particular the ArrayList - http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx.

For large datasets it is much faster than dictionaries to fill and comes complete with a sort, binary search and standard search functions. The sort is relatively slow, but the binary searches are fast once sorted.]]></description>
		<content:encoded><![CDATA[<p>Really interesting post, there is also another method that hasn&#8217;t been mentioned. Recently I&#8217;ve been playing with the System.Collection classes from .Net that are usable from Excel &#8211; in particular the ArrayList &#8211; <a href="http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx</a>.</p>
<p>For large datasets it is much faster than dictionaries to fill and comes complete with a sort, binary search and standard search functions. The sort is relatively slow, but the binary searches are fast once sorted.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
