Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
CJ
 
Posts: n/a
Default hyphenated number format with leading zeros to the right of the hy

I need to achieve a result like this: 12345-0001
However, the user does not want to type the leading zeros.

Help would be much appreciated!!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default hyphenated number format with leading zeros to the right of the hy

From your example I assume the numbers are of the form:

5 digits -000 1 digit

if the user just types in 123451 and the next cell has the formula:
=LEFT(A1,5)&"-000"&RIGHT(A1,1)
then it will display 12345-0001
just as you want.
_____________________________________
Gary's Student


"CJ" wrote:

I need to achieve a result like this: 12345-0001
However, the user does not want to type the leading zeros.

Help would be much appreciated!!!

  #3   Report Post  
Posted to microsoft.public.excel.misc
B. R.Ramachandran
 
Posts: n/a
Default hyphenated number format with leading zeros to the right of the hy

Hi,

Enter the following formula in B1, assuming that A1 contains the
user-entered number.

=LEFT(A1,5)&"-"&RIGHT(10000+RIGHT(A1,LEN(A1)-5),4)

The formula will convert,

123451 to 12345-0001
1234512 to 12345-0012
12345123 to 12345-0123
123451234 to 12345-1234

If the user enters a number containing less than 6 digits, it would return
an error as #VALUE!

If you have several user-entered numbers in column A (eg., A1:A101) enter
the above formula in B1 and fil-in the formula down to B101.

Hope this helps,
Regards,
B. R. Ramachandran

"CJ" wrote:

I need to achieve a result like this: 12345-0001
However, the user does not want to type the leading zeros.

Help would be much appreciated!!!

  #4   Report Post  
Posted to microsoft.public.excel.misc
CJ
 
Posts: n/a
Default hyphenated number format with leading zeros to the right of th

Thank you so much and also for the fast response! I kind of figured I was
going to have do something to the cell next to it but couldn't figure it out.

"Gary''s Student" wrote:

From your example I assume the numbers are of the form:

5 digits -000 1 digit

if the user just types in 123451 and the next cell has the formula:
=LEFT(A1,5)&"-000"&RIGHT(A1,1)
then it will display 12345-0001
just as you want.
_____________________________________
Gary's Student


"CJ" wrote:

I need to achieve a result like this: 12345-0001
However, the user does not want to type the leading zeros.

Help would be much appreciated!!!

  #5   Report Post  
Posted to microsoft.public.excel.misc
CJ
 
Posts: n/a
Default hyphenated number format with leading zeros to the right of th

Thank you!

"B. R.Ramachandran" wrote:

Hi,

Enter the following formula in B1, assuming that A1 contains the
user-entered number.

=LEFT(A1,5)&"-"&RIGHT(10000+RIGHT(A1,LEN(A1)-5),4)

The formula will convert,

123451 to 12345-0001
1234512 to 12345-0012
12345123 to 12345-0123
123451234 to 12345-1234

If the user enters a number containing less than 6 digits, it would return
an error as #VALUE!

If you have several user-entered numbers in column A (eg., A1:A101) enter
the above formula in B1 and fil-in the formula down to B101.

Hope this helps,
Regards,
B. R. Ramachandran

"CJ" wrote:

I need to achieve a result like this: 12345-0001
However, the user does not want to type the leading zeros.

Help would be much appreciated!!!

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
" / " Changing Decimal number format to Fraction on Protected Cell laudie Excel Worksheet Functions 0 November 15th 05 01:12 AM
Number format nsv Excel Discussion (Misc queries) 2 November 11th 05 01:05 PM
How do I force leading zeros in an Excel cell? EricKei Excel Discussion (Misc queries) 2 June 15th 05 08:28 PM
Format Number to Text Roni Excel Worksheet Functions 2 May 17th 05 03:17 PM
16 digit number wont keep alteration unless format cell to text Croc001 Excel Discussion (Misc queries) 3 March 30th 05 09:12 AM


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