Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default How to add 99 before 10 digits?


Hi all,

Greeting for the day.

I have serial number in a column like 0123456789 that is 10 digits

however it has to 990123456789

The actual requirement is when i copy paste any 10 digits in a cell say
A1 it should add 99 before 10 digits automatically to make it 12
digits.
And if it is 9 digit it should add 990 before the 9 digits
if it is 8 digit it should add 9900.

Any help would be much appreciated.

Thanks in Advance

Raja


--
Raja
------------------------------------------------------------------------
Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115078

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 913
Default How to add 99 before 10 digits?

On Sat, 11 Jul 2009 10:54:37 +0100, Raja
wrote:


Hi all,

Greeting for the day.

I have serial number in a column like 0123456789 that is 10 digits

however it has to 990123456789

The actual requirement is when i copy paste any 10 digits in a cell say
A1 it should add 99 before 10 digits automatically to make it 12
digits.
And if it is 9 digit it should add 990 before the 9 digits
if it is 8 digit it should add 9900.

Any help would be much appreciated.

Thanks in Advance

Raja


Try this macro

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:B10")) Is Nothing Then
If Len(Target.Value) < 12 And Target.Value 0 Then
Target.Value = Left("990000000000", 12 - Len(Target.Value)) &
Target.Value
End If
End If
End Sub

You don't say what to do with numbers with 11 or less than 8 digits,
but the same scheme is applied for them as for the 8,9, and 10 digit
numbers.
Change the range "A1:B10" to suit your needs.
You may also want to apply a custom number format, like 000000000000,
to the cells with these serial numbers.

Hope this helps / Lars-Åke

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default How to add 99 before 10 digits?


Raja;413082 Wrote:
Hi all,

Greeting for the day.

I have serial number in a column like 0123456789 that is 10 digits

however it has to 990123456789

The actual requirement is when i copy paste any 10 digits in a cell say
A1 it should add 99 before 10 digits automatically to make it 12
digits.
And if it is 9 digit it should add 990 before the 9 digits
if it is 8 digit it should add 9900.

Any help would be much appreciated.

Thanks in Advance

Raja


A possible formula solution
Code:
--------------------
=LEFT(("990000000000";12-LEN(A1))&A1)
--------------------


Replace ; with , if needed


--
Pecoflyer

Cheers -

'Firefox 3.5' (http://www.mozilla.com/en-US/firefox/all-beta.html)
really IS fast !
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115078

  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default How to add 99 before 10 digits?


Pecoflyer;413095 Wrote:
A possible formula solution

Code:
--------------------
=LEFT(("990000000000";12-LEN(A1))&A1)

--------------------


Replace ; with , if needed


Thanks advice please advice in which cell i hav eto copy paste the
formula


--
Raja
------------------------------------------------------------------------
Raja's Profile: http://www.thecodecage.com/forumz/member.php?userid=497
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115078

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default How to add 99 before 10 digits?


Raja;413100 Wrote:
Thanks advice please advice in which cell i hav eto copy paste the
formula
--- Automerged consecutive post before response ---


Thanks peocflyer

please advice where i have insert this formula as im new to excel.
--- Automerged consecutive post before response ---



Thanks for you reply,

i have inserted this code in the sheet1 view code but when checked its
not working please advice where i have apply this script.

Regards,

Raja


Pertaining to the formula you can insert it in any cell you need the
result to be


--
Pecoflyer

Cheers -

'Firefox 3.5' (http://www.mozilla.com/en-US/firefox/all-beta.html)
really IS fast !
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=115078



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
How do you change single digits to recognized double digits? Evil with a K[_2_] Excel Worksheet Functions 5 April 3rd 23 02:29 PM
11 digits Matt Excel Worksheet Functions 3 February 19th 09 10:01 PM
How to customize number to 10 digits including 2 digits after deci Carina Excel Worksheet Functions 3 September 20th 07 02:50 AM
4 Digits [email protected] Excel Discussion (Misc queries) 4 June 28th 07 07:53 PM
last 2 digits rexmann Excel Discussion (Misc queries) 2 March 6th 07 09:40 AM


All times are GMT +1. The time now is 09:13 AM.

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"