Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Tech
 
Posts: n/a
Default Extract phone number front block of text


I have a webpage that lists business names, address, phone number, etc.
There is no definite pattern to how they entered the text. What I'd
like to do is something like....

-Search cell A1 for "-", return the 3 characters to the left of the
"-".-

In the next column do...

-Search cell A1 for "-", return the 4 characters to the right of the
"-".-

Then I can concatenate the two and add in the area code.

TIA guys/gals.


PS. I tried searching but didn't know exactly what to search for and
didn't get very far.


--
Tech
------------------------------------------------------------------------
Tech's Profile: http://www.excelforum.com/member.php...o&userid=15107
View this thread: http://www.excelforum.com/showthread...hreadid=392890

  #2   Report Post  
swatsp0p
 
Posts: n/a
Default


HI, Tech. Where will you get the Area Code that you will 'add in'?

Also, how will you handle single cell entries that _also_ use the
hyphen in a business name (e.g. Allis-Chalmers) or a city (e.g.
Wilkes-Barre, PA) or a 9 digit ZIP code (e.g. 90210-1234)?

Things to ponder....

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=392890

  #3   Report Post  
Tech
 
Posts: n/a
Default


The area code is the same for every number (in this case). :)


--
Tech
------------------------------------------------------------------------
Tech's Profile: http://www.excelforum.com/member.php...o&userid=15107
View this thread: http://www.excelforum.com/showthread...hreadid=392890

  #4   Report Post  
Michael
 
Posts: n/a
Default

For the left three numbers, =MID(A1,(SEARCH("-",A1)-3),3). For the right
four numbers, =MID(A1,(SEARCH("-",A1)+1),4). If these formula are in B1 and
C1, to combine the numbers with the area code, "925 "&B1&"-"&C1. HTH
--
Sincerely, Michael Colvin


"Tech" wrote:


I have a webpage that lists business names, address, phone number, etc.
There is no definite pattern to how they entered the text. What I'd
like to do is something like....

-Search cell A1 for "-", return the 3 characters to the left of the
"-".-

In the next column do...

-Search cell A1 for "-", return the 4 characters to the right of the
"-".-

Then I can concatenate the two and add in the area code.

TIA guys/gals.


PS. I tried searching but didn't know exactly what to search for and
didn't get very far.


--
Tech
------------------------------------------------------------------------
Tech's Profile: http://www.excelforum.com/member.php...o&userid=15107
View this thread: http://www.excelforum.com/showthread...hreadid=392890


  #5   Report Post  
Tech
 
Posts: n/a
Default


Worked great! Thanks for your help! :)


--
Tech
------------------------------------------------------------------------
Tech's Profile: http://www.excelforum.com/member.php...o&userid=15107
View this thread: http://www.excelforum.com/showthread...hreadid=392890



  #6   Report Post  
swatsp0p
 
Posts: n/a
Default


Of course, you could combine Michael's formula into one cell, as such:

in B1 ="925
"&MID(A1,(SEARCH("-",A1)-3),3)&"-"&MID(A1,(SEARCH("-",A1)+1),4)

The result would be, e.g.

952 123-4567

Good Luck

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=392890

  #7   Report Post  
Michael
 
Posts: n/a
Default

Glad it worked. Thanks for the feedback.
--
Sincerely, Michael Colvin


"Tech" wrote:


Worked great! Thanks for your help! :)


--
Tech
------------------------------------------------------------------------
Tech's Profile: http://www.excelforum.com/member.php...o&userid=15107
View this thread: http://www.excelforum.com/showthread...hreadid=392890


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
breaking up a phone number maximus73 Excel Discussion (Misc queries) 7 August 3rd 05 06:57 PM
Conversion of a Number into English Text Nasir Ali Excel Worksheet Functions 1 July 28th 05 08:50 AM
Phone Dialer Pat Excel Discussion (Misc queries) 5 January 7th 05 06:28 PM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM
Adding + in front of a number Ted Metro Excel Discussion (Misc queries) 3 December 29th 04 10:45 PM


All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"