Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Concatenate or not?

I need to take the contents of three cells and combine them to form a
telephone #, but when a number in cell begins with 0's, the concatenation
function breaks, here's an example;

The cells (A5, B5 & C5) contain; 913 449 0004

The formula in D5 is; =CONCATENATE(A5,"- ",B5,"-",C5)

The result is 913-449-4 instead of the desired 913-449-0004

The only solution I found was to format the cells as text, but then the
worksheet is full of cells with the little triangles in the corner of each
cell. Currently the cells are set to custom formatting to display 4
numbers, but that doesn't help the result.

Any ideas?

Thanks,
David...


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Concatenate or not?

The cells (A5, B5 & C5) contain; 913 449 0004

Assuming C5 is custom number formatted as 0000.

=TEXT(A5,"000-")&TEXT(B5,"000-")&TEXT(C5,"0000")


--
Biff
Microsoft Excel MVP


"DavidJ726" wrote in message
...
I need to take the contents of three cells and combine them to form a
telephone #, but when a number in cell begins with 0's, the concatenation
function breaks, here's an example;

The cells (A5, B5 & C5) contain; 913 449 0004

The formula in D5 is; =CONCATENATE(A5,"- ",B5,"-",C5)

The result is 913-449-4 instead of the desired 913-449-0004

The only solution I found was to format the cells as text, but then the
worksheet is full of cells with the little triangles in the corner of each
cell. Currently the cells are set to custom formatting to display 4
numbers, but that doesn't help the result.

Any ideas?

Thanks,
David...



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Concatenate or not?

P.S.

I'm not a "phone number expert". I don't know if the area code can start
with leading zeros or if the next 3 digits can have leading zeros. So, the
formula I suggested uses a TEXT function call for each set of numbers. If
the area code and the next set of digits can't have leading zeros then you
can reduce the formula to:

=A5&"-"&B5&"-"&TEXT(C5,"0000")

Result: 913-449-0004

Or, you could even use this formula and format as SpecialPhone number:

=--(A5&B5&TEXT(C5,"0000"))

Result: (913) 449-0004



--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
The cells (A5, B5 & C5) contain; 913 449 0004


Assuming C5 is custom number formatted as 0000.

=TEXT(A5,"000-")&TEXT(B5,"000-")&TEXT(C5,"0000")


--
Biff
Microsoft Excel MVP


"DavidJ726" wrote in message
...
I need to take the contents of three cells and combine them to form a
telephone #, but when a number in cell begins with 0's, the concatenation
function breaks, here's an example;

The cells (A5, B5 & C5) contain; 913 449 0004

The formula in D5 is; =CONCATENATE(A5,"- ",B5,"-",C5)

The result is 913-449-4 instead of the desired 913-449-0004

The only solution I found was to format the cells as text, but then the
worksheet is full of cells with the little triangles in the corner of
each cell. Currently the cells are set to custom formatting to display 4
numbers, but that doesn't help the result.

Any ideas?

Thanks,
David...





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Concatenate or not?

Bill, Thanks for the quick response, as well as the solution(s). The 1st is
exactly what I needed, the 2nd answer was icing on the cake :-)

"DavidJ726" wrote in message
...
I need to take the contents of three cells and combine them to form a
telephone #, but when a number in cell begins with 0's, the concatenation
function breaks, here's an example;

The cells (A5, B5 & C5) contain; 913 449 0004

The formula in D5 is; =CONCATENATE(A5,"- ",B5,"-",C5)

The result is 913-449-4 instead of the desired 913-449-0004

The only solution I found was to format the cells as text, but then the
worksheet is full of cells with the little triangles in the corner of each
cell. Currently the cells are set to custom formatting to display 4
numbers, but that doesn't help the result.

Any ideas?

Thanks,
David...



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Concatenate or not?

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"DavidJ726" wrote in message
...
Bill, Thanks for the quick response, as well as the solution(s). The 1st
is exactly what I needed, the 2nd answer was icing on the cake :-)

"DavidJ726" wrote in message
...
I need to take the contents of three cells and combine them to form a
telephone #, but when a number in cell begins with 0's, the concatenation
function breaks, here's an example;

The cells (A5, B5 & C5) contain; 913 449 0004

The formula in D5 is; =CONCATENATE(A5,"- ",B5,"-",C5)

The result is 913-449-4 instead of the desired 913-449-0004

The only solution I found was to format the cells as text, but then the
worksheet is full of cells with the little triangles in the corner of
each cell. Currently the cells are set to custom formatting to display 4
numbers, but that doesn't help the result.

Any ideas?

Thanks,
David...





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
Concatenate help Igneshwara reddy[_2_] Excel Worksheet Functions 7 August 30th 07 12:15 AM
concatenate every second row to first row Kelly E. Excel Discussion (Misc queries) 2 January 10th 06 04:25 PM
concatenate and then take off last # NTaylor Excel Discussion (Misc queries) 6 December 21st 05 06:04 PM
=CONCATENATE() help! shfcook Excel Worksheet Functions 4 September 14th 05 11:01 AM
I know how to concatenate ,can one de-concatenate to split date? QUICK BOOKS PROBLEM- New Users to Excel 1 July 26th 05 05:07 PM


All times are GMT +1. The time now is 07:18 PM.

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

About Us

"It's about Microsoft Excel"