![]() |
#1
|
|||
|
|||
![]()
Morning!
I'm experiencing a hard time trying to figure out a number format mask in Excel. The number format is quite simple: just numbers, dots and a hyphen. The format is: 0003475-09.2014.8.05.0001 (7 numbers, hyphen, 2 numbers, dot, 4 numbers, dot, 1 number, dot, 2 numbers, dot, 4 numbers). I put the following mask in Excel: 0000000-00"."0000"."0"."00"."0000 Here is the trick: Excel put the number in the given mask, but it always changes the 2 last numbers to zeroes ("00"). E.g., if I feed the number 00034750920148059987, I get back the result 0003475-09.2014.8.05.9900. If I feed the number 00034750920148054567, the result is 0003475-09.2014.8.05.4500. Can somebody help me, please? |
#2
|
|||
|
|||
![]()
very peculiar. It seems that a custom format like that always wants to end with 2 zeroes. Must have something to do with Scientific Notation. If is possible to do what you want using cells formatted as text and then the following formula in a corresponding cell.
Code:
=MID(G1,1,7)&"-"&MID(G1,8,2)&"."&MID(G1,10,4)&"."&MID(G1,14,1)&"."&MID(G1,15,2)&"."&RIGHT(G1,4) Sorry this isnt exactly what you are looking for but we could also write a VBA script which will keep it in the same cell after you process the code or on worksheet change. Lots of options here. Thanks |
#3
|
|||
|
|||
![]()
Though it is not exactly what I wanted, it will work. I just have to adjust the formula a little to fill the leading zeroes, but it is no problem.
This solution answer my need, but my curiosity really thrives to understand what does lead excel to the original misinterpretation. ![]() Thanks for your time! Your answer is a fair solution to my problem! ![]() |
#4
|
|||
|
|||
![]()
Hi,
On Excel, numbers must conform to IEEE 757 standards of 15 characters or less, any digit beyond 15 is replaced by "0". That's why you need to treat numbers with more that 15 chars as text. |
#5
|
|||
|
|||
![]()
Ooooown!
Ok, now I understand. Thank you for spending your time providing me a solution and an answer, guys. |
![]() |
Tags |
number formatting |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Mole Patrol | Word | 2 | 09-18-2013 11:46 AM |
![]() |
Jamal NUMAN | Word | 1 | 09-03-2011 11:37 AM |
![]() |
lugibson | Word | 3 | 08-12-2011 03:45 AM |
![]() |
ilkks | Word | 3 | 05-25-2011 02:27 PM |
Number of lines on page problem | JamesT | Word | 0 | 08-27-2009 04:52 PM |