If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > add - to cell data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-10, 11:28
Chimp8471 Chimp8471 is offline
Registered User
 
Join Date: Mar 2003
Posts: 225
add - to cell data

i have a 10 digit value in my cell which i need to change to match the following:

now

1234567890

required

1-234-56-789-0

with the dashes always being in after the:

1st, 4th, 6th and 9th numbers

please advise
Reply With Quote
  #2 (permalink)  
Old 06-23-10, 11:58
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi,

If it is just for display purposes, format the cell with this custom type:
#-###-##-###-#



If you really need to have the hyphens within the value then you could use a formula such as:
Code:
=LEFT(A1)&"-"&MID(A1,2,3)&"-"&MID(A1,5,2)&"-"&MID(A1,7,3)&"-"&RIGHT(A1)
Hope that helps...
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 06-23-10, 12:56
Chimp8471 Chimp8471 is offline
Registered User
 
Join Date: Mar 2003
Posts: 225
ok it's nearly there, with the above formula i get

7-483-3-44-7

from

7483440017

i am loosing a few digits


I need

7-483-44-001-7

Any ideas?
Reply With Quote
  #4 (permalink)  
Old 06-23-10, 13:01
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
The formula I posted works absolutely fine for me. Example attached.
Attached Files
File Type: zip Example.zip (1.6 KB, 7 views)
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #5 (permalink)  
Old 06-23-10, 13:21
Chimp8471 Chimp8471 is offline
Registered User
 
Join Date: Mar 2003
Posts: 225
ok it seems to be a formatting issue, thanks for your help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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