<?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: Clean up Incorrectly Formatted Phone Numbers using Excel</title>
	<atom:link href="http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/</link>
	<description>Fresh Excel Tips, Tricks, Charts, Tutorials, Downloads, Dashboards and Visualization Showcase for your Inspiration and Productivity</description>
	<lastBuildDate>Sun, 14 Mar 2010 11:20:44 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Nelson</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-70382</link>
		<dc:creator>Nelson</dc:creator>
		<pubDate>Thu, 16 Jul 2009 19:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-70382</guid>
		<description>Ok - I tried following the above instructions and created the UDF and even added it to my &quot;add-ins&quot;, but in the cell where I am putting the formula, i&#039;m seeing the following result:  &quot;#NAME?&quot;.  When I step through the logic on the formula, it&#039;s not recognizing the name &quot;cleanphonenumber&quot; in the formula.

What am I missing here?</description>
		<content:encoded><![CDATA[<p>Ok &#8211; I tried following the above instructions and created the UDF and even added it to my &#8220;add-ins&#8221;, but in the cell where I am putting the formula, i&#8217;m seeing the following result:  &#8220;#NAME?&#8221;.  When I step through the logic on the formula, it&#8217;s not recognizing the name &#8220;cleanphonenumber&#8221; in the formula.</p>
<p>What am I missing here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandoo</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-26759</link>
		<dc:creator>Chandoo</dc:creator>
		<pubDate>Fri, 31 Oct 2008 23:04:44 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-26759</guid>
		<description>@Sam: Thanks for the comments. Welcome :)
You can install a vba user defined function (UDF) like this very simply. Just follow these steps:

1. In your workbook, right click on the sheet name and select view code
2. in the resulting window, click menu &gt; insert &gt; module
3. You will see a blank module (basically a place where you can write all your macros and udfs), copy paste the code from here to there
4. save by pressing ctrl+s
5. close it and return to your excel sheet
6. save the work book, just in case
7. Now use the cleanPhoneNumber() in your cells like you would use sum(), if() etc.

remember, using this method, the cleanPhoneNumber() will only work in that particular workbook. If you need to use it in all the workbooks, just save the file as &quot;Excel add in&quot; type (menu &gt; save as, and file type).
Now from tools &gt; addins, click browse and point to the saved excel addin file. Once the file is shown, make sure you check it to install that add-in. This way, you can use cleanPhoneNumber() in all the workbooks.

Let me know if you have any difficulties with this method.</description>
		<content:encoded><![CDATA[<p>@Sam: Thanks for the comments. Welcome <img src='http://chandoo.org/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
You can install a vba user defined function (UDF) like this very simply. Just follow these steps:</p>
<p>1. In your workbook, right click on the sheet name and select view code<br />
2. in the resulting window, click menu > insert > module<br />
3. You will see a blank module (basically a place where you can write all your macros and udfs), copy paste the code from here to there<br />
4. save by pressing ctrl+s<br />
5. close it and return to your excel sheet<br />
6. save the work book, just in case<br />
7. Now use the cleanPhoneNumber() in your cells like you would use sum(), if() etc.</p>
<p>remember, using this method, the cleanPhoneNumber() will only work in that particular workbook. If you need to use it in all the workbooks, just save the file as &#8220;Excel add in&#8221; type (menu > save as, and file type).<br />
Now from tools > addins, click browse and point to the saved excel addin file. Once the file is shown, make sure you check it to install that add-in. This way, you can use cleanPhoneNumber() in all the workbooks.</p>
<p>Let me know if you have any difficulties with this method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-26755</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Fri, 31 Oct 2008 20:28:26 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-26755</guid>
		<description>This looks great!  How can add this add-in to my Excel workbooks?  I don&#039;t know anything about VBA and don&#039;t have VBE.  Is there a way for me to use this code some other way?  Has anyone already packaged it up as an add-in I can download?  If so, I would love you forever!

-Sam</description>
		<content:encoded><![CDATA[<p>This looks great!  How can add this add-in to my Excel workbooks?  I don&#8217;t know anything about VBA and don&#8217;t have VBE.  Is there a way for me to use this code some other way?  Has anyone already packaged it up as an add-in I can download?  If so, I would love you forever!</p>
<p>-Sam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-23876</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Wed, 01 Oct 2008 16:37:04 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-23876</guid>
		<description>What I&#039;ll probably do is convert your code to a routine that can be used on a selection (similar to what mine is now), merge some of my code in, and add a few conditions, for example since I deal with US phone numbers only:

If Len(retNumber) &lt; 10 Then
cleanPhoneNumber = &quot;not valid&quot; &#039; show error

or

If Len(retNumber) &lt; 10 Then 
cleanPhoneNumber = retNumber &#039; just return the number</description>
		<content:encoded><![CDATA[<p>What I&#8217;ll probably do is convert your code to a routine that can be used on a selection (similar to what mine is now), merge some of my code in, and add a few conditions, for example since I deal with US phone numbers only:</p>
<p>If Len(retNumber) &lt; 10 Then<br />
cleanPhoneNumber = &#8220;not valid&#8221; &#8216; show error</p>
<p>or</p>
<p>If Len(retNumber) &lt; 10 Then<br />
cleanPhoneNumber = retNumber &#8216; just return the number</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chandoo</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-23870</link>
		<dc:creator>Chandoo</dc:creator>
		<pubDate>Wed, 01 Oct 2008 14:24:17 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-23870</guid>
		<description>@JP.. that is one reason for writing the above function.. I wanted to comeup with something that can applied to almost all cases... As I mentioned in the article, most of the times we know how the incoming format is.. in those cases your code is suitable.</description>
		<content:encoded><![CDATA[<p>@JP.. that is one reason for writing the above function.. I wanted to comeup with something that can applied to almost all cases&#8230; As I mentioned in the article, most of the times we know how the incoming format is.. in those cases your code is suitable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JP</title>
		<link>http://chandoo.org/wp/2008/09/30/clean-up-incorrectly-formatted-phone-numbers-using-excel/#comment-23814</link>
		<dc:creator>JP</dc:creator>
		<pubDate>Tue, 30 Sep 2008 23:17:44 +0000</pubDate>
		<guid isPermaLink="false">http://chandoo.org/wp/?p=1350#comment-23814</guid>
		<description>Here&#039;s the code I use, but I like yours better since it handles text. My code assumes that it&#039;s only numbers and maybe a few odd characters:

Sub Convert_Phone()
Application.ScreenUpdating = False
&#039;
&#039; first highlight the section you want to work on
&#039;
With Selection.SpecialCells(xlConstants)
   .Replace what:=Chr(160), Replacement:=&quot;&quot;, LookAt:=xlPart, _ 
	SearchOrder:=xlByColumns, MatchCase:=True
   .Replace what:=Chr(32), Replacement:=&quot;&quot;, LookAt:=xlPart, _
	SearchOrder:=xlByColumns, MatchCase:=True
   .Replace what:=&quot;)&quot;, Replacement:=&quot;&quot;, LookAt:=xlPart, _ 
	SearchOrder:=xlByColumns, MatchCase:=True
   .Replace what:=&quot;(&quot;, Replacement:=&quot;&quot;, LookAt:=xlPart, _ 
	SearchOrder:=xlByColumns, MatchCase:=True
   .Replace what:=&quot;-&quot;, Replacement:=&quot;&quot;, LookAt:=xlPart, _
	SearchOrder:=xlByColumns, MatchCase:=True
   .Replace what:=&quot;+&quot;, Replacement:=&quot;&quot;, LookAt:=xlPart, _
	SearchOrder:=xlByColumns, MatchCase:=True
End With

&#039; at this point you could do one of two things:
&#039; 1. do a &quot;virtual&quot; format where you just make the cell *appear* to be a 
&#039; phone number.
&#039; Selection.NumberFormat = &quot;(###) ###-####&quot;

&#039; 2. We can actually insert the parentheses and dash in the appropriate place.
&#039; 
&#039; For each cell in Selection
&#039;  cell = &quot;(&quot; &amp; Left(cell, 3) &amp; &quot;) &quot; &amp; Mid(cell, 4, 3) &amp; &quot;-&quot; &amp; Right(cell, 4)
&#039; Next cell
&#039;
&#039; uncomment whichever one you want!
&#039;
&#039;
Application.ScreenUpdating = True
End Sub</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the code I use, but I like yours better since it handles text. My code assumes that it&#8217;s only numbers and maybe a few odd characters:</p>
<p>Sub Convert_Phone()<br />
Application.ScreenUpdating = False<br />
&#8216;<br />
&#8216; first highlight the section you want to work on<br />
&#8216;<br />
With Selection.SpecialCells(xlConstants)<br />
   .Replace what:=Chr(160), Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
   .Replace what:=Chr(32), Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
   .Replace what:=&#8221;)&#8221;, Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
   .Replace what:=&#8221;(&#8221;, Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
   .Replace what:=&#8221;-&#8221;, Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
   .Replace what:=&#8221;+&#8221;, Replacement:=&#8221;", LookAt:=xlPart, _<br />
	SearchOrder:=xlByColumns, MatchCase:=True<br />
End With</p>
<p>&#8216; at this point you could do one of two things:<br />
&#8216; 1. do a &#8220;virtual&#8221; format where you just make the cell *appear* to be a<br />
&#8216; phone number.<br />
&#8216; Selection.NumberFormat = &#8220;(###) ###-####&#8221;</p>
<p>&#8216; 2. We can actually insert the parentheses and dash in the appropriate place.<br />
&#8216;<br />
&#8216; For each cell in Selection<br />
&#8216;  cell = &#8220;(&#8221; &amp; Left(cell, 3) &amp; &#8220;) &#8221; &amp; Mid(cell, 4, 3) &amp; &#8220;-&#8221; &amp; Right(cell, 4)<br />
&#8216; Next cell<br />
&#8216;<br />
&#8216; uncomment whichever one you want!<br />
&#8216;<br />
&#8216;<br />
Application.ScreenUpdating = True<br />
End Sub</p>
]]></content:encoded>
	</item>
</channel>
</rss>
