Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Disaster Lady
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell?

I want to change telephone numbers from format (XXX) XXX-XXXX to
1-XXX-XXX-XXXX. I also want to add 1-XXX to XXX-XXXX in cells.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Miguel Zapico
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell?

Provided that you only have those two formats, you may try a formula like this:
=IF(LEN(A1)10,"1-" & MID(A1,2,3) & "-" & RIGHT(A1,8),"1-XXX-" & A1)
If the 1-XXX is not the same in all cases, you may need to edit the formula
to point a reference instead of the hard-coded number.

Hope this helps,
Miguel.

"Disaster Lady" wrote:

I want to change telephone numbers from format (XXX) XXX-XXXX to
1-XXX-XXX-XXXX. I also want to add 1-XXX to XXX-XXXX in cells.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Disaster Lady
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

Thanks. I'll give that a try today.

"Miguel Zapico" wrote:

Provided that you only have those two formats, you may try a formula like this:
=IF(LEN(A1)10,"1-" & MID(A1,2,3) & "-" & RIGHT(A1,8),"1-XXX-" & A1)
If the 1-XXX is not the same in all cases, you may need to edit the formula
to point a reference instead of the hard-coded number.

Hope this helps,
Miguel.

"Disaster Lady" wrote:

I want to change telephone numbers from format (XXX) XXX-XXXX to
1-XXX-XXX-XXXX. I also want to add 1-XXX to XXX-XXXX in cells.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Disaster Lady
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

The formula works nicely for instering "1-585" into the cells.

My problem is (and I didn't explain it well enough the first time) that I
have existing data in the cells. For example: telephone numbers exist in
cells AE2....AE2500. They already have phone numbers in them like 555-1212
and (716) 555-1212. I want to systematically change 555-1212 to
1-585-555-1212 and (716) 555-1212 to 1-716-555-1212.

I am an intermediate user of Excel and can mess with formulas a bit, but it
seems that whatever formula I use, I will still have to re-enter the data
into each cell (all 2500 of them). That's what I'm trying to avoid if I can.

Thanks for your help.

"Miguel Zapico" wrote:

Provided that you only have those two formats, you may try a formula like this:
=IF(LEN(A1)10,"1-" & MID(A1,2,3) & "-" & RIGHT(A1,8),"1-XXX-" & A1)
If the 1-XXX is not the same in all cases, you may need to edit the formula
to point a reference instead of the hard-coded number.

Hope this helps,
Miguel.

"Disaster Lady" wrote:

I want to change telephone numbers from format (XXX) XXX-XXXX to
1-XXX-XXX-XXXX. I also want to add 1-XXX to XXX-XXXX in cells.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

In a blank column (let's assume this is column AM), enter this into
cell AM2:

=IF(LEFT(AE2,1)="(","1-"&MID(AE2,2,3)&"-"&RIGHT(AE2,8),"1-585-"&AE2)

and copy down to AM2500. This assumes the phone numbers are in the two
formats described, and works by examining the first character of the
number - if it is "(", as in "(716) 555-1212", this will be converted
to "1-716-555-1212", otherwise it will have "1-585-" appended to the
beginning of it.

If you want these converted numbers to replace the ones you have, then
highlight the cells AM2:AM2500, click <copy, then Edit | Paste Special
| Values (check) | OK then <Enter - this will have fixed the values in
column AM. You could then <cut these values and <paste them to
overwrite the values in column AE.

Hope this helps.

Pete



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Disaster Lady
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

Pete...

It worked beautifully. You've made a few people here quite happy today.

Thanks.

"Pete_UK" wrote:

In a blank column (let's assume this is column AM), enter this into
cell AM2:

=IF(LEFT(AE2,1)="(","1-"&MID(AE2,2,3)&"-"&RIGHT(AE2,8),"1-585-"&AE2)

and copy down to AM2500. This assumes the phone numbers are in the two
formats described, and works by examining the first character of the
number - if it is "(", as in "(716) 555-1212", this will be converted
to "1-716-555-1212", otherwise it will have "1-585-" appended to the
beginning of it.

If you want these converted numbers to replace the ones you have, then
highlight the cells AM2:AM2500, click <copy, then Edit | Paste Special
| Values (check) | OK then <Enter - this will have fixed the values in
column AM. You could then <cut these values and <paste them to
overwrite the values in column AE.

Hope this helps.

Pete


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

Thanks for the feedback.

Pete

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8
Default How can I automatically add an area code to a number in a cell

Pete - your formula would work perfect for us with one exception. We want to
convert telephone numbers xxx-xxx-xxxx to (xxx) xxx-xxxx and to add area
codes. I do not understand complicated formula's so how would I change this
formula to work for me? I will be eternally grateful
CodyKid

"Pete_UK" wrote:

In a blank column (let's assume this is column AM), enter this into
cell AM2:

=IF(LEFT(AE2,1)="(","1-"&MID(AE2,2,3)&"-"&RIGHT(AE2,8),"1-585-"&AE2)

and copy down to AM2500. This assumes the phone numbers are in the two
formats described, and works by examining the first character of the
number - if it is "(", as in "(716) 555-1212", this will be converted
to "1-716-555-1212", otherwise it will have "1-585-" appended to the
beginning of it.

If you want these converted numbers to replace the ones you have, then
highlight the cells AM2:AM2500, click <copy, then Edit | Paste Special
| Values (check) | OK then <Enter - this will have fixed the values in
column AM. You could then <cut these values and <paste them to
overwrite the values in column AE.

Hope this helps.

Pete


  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Beege
 
Posts: n/a
Default How can I automatically add an area code to a number in a cell

Disaster-

Could you start by a search and replace?

Search "(", replace ""
Search ") ", replace "-"

Then dealing with adding area codes and ones might be simpler...

Beege

"Disaster Lady" wrote in message
...
The formula works nicely for instering "1-585" into the cells.

My problem is (and I didn't explain it well enough the first time) that I
have existing data in the cells. For example: telephone numbers exist in
cells AE2....AE2500. They already have phone numbers in them like
555-1212
and (716) 555-1212. I want to systematically change 555-1212 to
1-585-555-1212 and (716) 555-1212 to 1-716-555-1212.

I am an intermediate user of Excel and can mess with formulas a bit, but
it
seems that whatever formula I use, I will still have to re-enter the data
into each cell (all 2500 of them). That's what I'm trying to avoid if I
can.

Thanks for your help.

"Miguel Zapico" wrote:

Provided that you only have those two formats, you may try a formula like
this:
=IF(LEN(A1)10,"1-" & MID(A1,2,3) & "-" & RIGHT(A1,8),"1-XXX-" & A1)
If the 1-XXX is not the same in all cases, you may need to edit the
formula
to point a reference instead of the hard-coded number.

Hope this helps,
Miguel.

"Disaster Lady" wrote:

I want to change telephone numbers from format (XXX) XXX-XXXX to
1-XXX-XXX-XXXX. I also want to add 1-XXX to XXX-XXXX in cells.



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
Conditional Format as a MACRO Gunjani Excel Worksheet Functions 3 March 29th 06 05:22 PM
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Instead of a negative number, I'd like to show zero... Dr. Darrell Excel Worksheet Functions 6 December 7th 05 08:21 PM
Can I make the number in one cell automatically appear elsewhere? holmeshouse Excel Worksheet Functions 2 August 17th 05 01:12 PM
Format the Cell into a telephone number but using country code Chris Quinn Excel Discussion (Misc queries) 1 January 27th 05 03:51 PM


All times are GMT +1. The time now is 10:03 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"