ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   TEXT (https://www.excelbanter.com/excel-discussion-misc-queries/149584-text.html)

adeel via OfficeKB.com

TEXT
 
I have large number of coding data like this (K4115KBA02WB005) these are 15
digits, what i want is to enter - sign after 10 digit (like K4115KBA02-WB005).
please tell me some short way.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200707/1


[email protected]

TEXT
 
On Jul 10, 9:12 am, "adeel via OfficeKB.com" <u32736@uwe wrote:
I have large number of coding data like this (K4115KBA02WB005) these are 15
digits, what i want is to enter - sign after 10 digit (like K4115KBA02-WB005).
please tell me some short way.

--
Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/ms-excel/200707/1


left(a1,10)&"-"&right(a1,5) should be close. just substitute your cell
for a1.


PCLIVE

TEXT
 
Use a helper column. If your data is in column A (beginning at A1), then in
another column (Z1 for example) enter the following formula and copy down as
needed.

HTH,
Paul

"adeel via OfficeKB.com" <u32736@uwe wrote in message
news:74f6e21805dec@uwe...
I have large number of coding data like this (K4115KBA02WB005) these are 15
digits, what i want is to enter - sign after 10 digit (like
K4115KBA02-WB005).
please tell me some short way.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200707/1




CLR

TEXT
 
If the number of characters should not always be 15, then this code might
work to add the hyphen after the 10th character if one exists.

Sub addHyphen()
'Select Range manually, then run macro to add hyphen after
'the 10th character if it exists.
Dim cell As Range
For Each cell In Selection
If Len(cell.Value) 10 Then
cell.Value = Left(cell.Value, 10) & "-" & Mid(cell.Value, 11, 99)
Else: cell.Value = "'" & cell.Value
End If
Next cell
End Sub

Vaya con Dios,
Chuck, CABGx3



"adeel via OfficeKB.com" wrote:

I have large number of coding data like this (K4115KBA02WB005) these are 15
digits, what i want is to enter - sign after 10 digit (like K4115KBA02-WB005).
please tell me some short way.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200707/1



PCLIVE

TEXT
 
It might have helped if I included the formula.

=LEFT(A1,20)&"-" & RIGHT(A1,LEN(A1)-10)

Regards,
Paul

"PCLIVE" wrote in message
...
Use a helper column. If your data is in column A (beginning at A1), then
in another column (Z1 for example) enter the following formula and copy
down as needed.

HTH,
Paul

"adeel via OfficeKB.com" <u32736@uwe wrote in message
news:74f6e21805dec@uwe...
I have large number of coding data like this (K4115KBA02WB005) these are
15
digits, what i want is to enter - sign after 10 digit (like
K4115KBA02-WB005).
please tell me some short way.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200707/1







All times are GMT +1. The time now is 11:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com