PC Review


Reply
Thread Tools Rate Thread

Converting a number (17 characters) to text (Scientific Notation)

 
 
MikeL
Guest
Posts: n/a
 
      20th Apr 2010
Here’s my dilemma and challenge…

… This is through Automation…

I’m receiving an XML file that has excel formatting…

It’s very easy to import, the problem comes in when I import large numbers
(17 – 20 characters long)… They should be imported as text, but they are
importing as numbers, so they appear as scientific notation… When I go to
create a file from the data, the numbers are being written in the scientific
notation and not as text…

I am unable to control the content of the XML file. I do know the number is
in a certain column…

Also, when I double click on a cell, I can edit it and place a single quote
and it will store the number correctly… But, when I do it through automation,
it won’t convert…

We are using excel 2003… In the process of upgrading to 2007, but won’t be
for another 6 months…

Fustrating...

Your help would be greatly appreciated..

Thanks,
Michael

 
Reply With Quote
 
 
 
 
Gary Brown
Guest
Posts: n/a
 
      20th Apr 2010
1st of all, only the first 15 digits will convert. The rest will be '0's.
Example, importing 12345678901234567890 to Excel will convert to
12345678901234500000.

To convert an entire column of numbers to text quickly, you can use
something like...
Selection.TextToColumns _
Destination:=Selection.Range("A1"), _
DataType:=xlFixedWidth, _
FieldInfo:=Array(0, xlTextFormat), _
TrailingMinusNumbers:=True

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"MikeL" wrote:

> Here’s my dilemma and challenge…
>
> … This is through Automation…
>
> I’m receiving an XML file that has excel formatting…
>
> It’s very easy to import, the problem comes in when I import large numbers
> (17 – 20 characters long)… They should be imported as text, but they are
> importing as numbers, so they appear as scientific notation… When I go to
> create a file from the data, the numbers are being written in the scientific
> notation and not as text…
>
> I am unable to control the content of the XML file. I do know the number is
> in a certain column…
>
> Also, when I double click on a cell, I can edit it and place a single quote
> and it will store the number correctly… But, when I do it through automation,
> it won’t convert…
>
> We are using excel 2003… In the process of upgrading to 2007, but won’t be
> for another 6 months…
>
> Fustrating...
>
> Your help would be greatly appreciated..
>
> Thanks,
> Michael
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      20th Apr 2010
I'm not sure how you're importing that XML file, but if you want to preserve all
17 digits, maybe you can bring the data in as text and then clean up the stuff
that doesn't belong.



MikeL wrote:
>
> Here’s my dilemma and challenge…
>
> … This is through Automation…
>
> I’m receiving an XML file that has excel formatting…
>
> It’s very easy to import, the problem comes in when I import large numbers
> (17 – 20 characters long)… They should be imported as text, but they are
> importing as numbers, so they appear as scientific notation… When I go to
> create a file from the data, the numbers are being written in the scientific
> notation and not as text…
>
> I am unable to control the content of the XML file. I do know the number is
> in a certain column…
>
> Also, when I double click on a cell, I can edit it and place a single quote
> and it will store the number correctly… But, when I do it through automation,
> it won’t convert…
>
> We are using excel 2003… In the process of upgrading to 2007, but won’t be
> for another 6 months…
>
> Fustrating...
>
> Your help would be greatly appreciated..
>
> Thanks,
> Michael


--

Dave Peterson
 
Reply With Quote
 
MikeL
Guest
Posts: n/a
 
      21st May 2010
Dave, Can't thank you enough for the reminder aoubt the 17 didget
truncation... (Saved alot of rework here...) I could not figure out a way
to import as text... (no filed definitions like open workbook...) But, when
I tried importing the XML in access, it recognized it as text, and the import
worked flawlessly... Again, because of the reminder, I went a different
route... If you didn't nuge us in the right direction, it would have been a
disaster.... (Thanks for going the extra mile... and making sure that we
understood...)

"Dave Peterson" wrote:

> I'm not sure how you're importing that XML file, but if you want to preserve all
> 17 digits, maybe you can bring the data in as text and then clean up the stuff
> that doesn't belong.
>
>
>
> MikeL wrote:
> >
> > Here’s my dilemma and challenge…
> >
> > … This is through Automation…
> >
> > I’m receiving an XML file that has excel formatting…
> >
> > It’s very easy to import, the problem comes in when I import large numbers
> > (17 – 20 characters long)… They should be imported as text, but they are
> > importing as numbers, so they appear as scientific notation… When I go to
> > create a file from the data, the numbers are being written in the scientific
> > notation and not as text…
> >
> > I am unable to control the content of the XML file. I do know the number is
> > in a certain column…
> >
> > Also, when I double click on a cell, I can edit it and place a single quote
> > and it will store the number correctly… But, when I do it through automation,
> > it won’t convert…
> >
> > We are using excel 2003… In the process of upgrading to 2007, but won’t be
> > for another 6 months…
> >
> > Fustrating...
> >
> > Your help would be greatly appreciated..
> >
> > Thanks,
> > Michael

>
> --
>
> Dave Peterson
> .
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      21st May 2010
Glad you found a solution to the problem.

MikeL wrote:
>
> Dave, Can't thank you enough for the reminder aoubt the 17 didget
> truncation... (Saved alot of rework here...) I could not figure out a way
> to import as text... (no filed definitions like open workbook...) But, when
> I tried importing the XML in access, it recognized it as text, and the import
> worked flawlessly... Again, because of the reminder, I went a different
> route... If you didn't nuge us in the right direction, it would have been a
> disaster.... (Thanks for going the extra mile... and making sure that we
> understood...)
>
> "Dave Peterson" wrote:
>
> > I'm not sure how you're importing that XML file, but if you want to preserve all
> > 17 digits, maybe you can bring the data in as text and then clean up the stuff
> > that doesn't belong.
> >
> >
> >
> > MikeL wrote:
> > >
> > > Here’s my dilemma and challenge…
> > >
> > > … This is through Automation…
> > >
> > > I’m receiving an XML file that has excel formatting…
> > >
> > > It’s very easy to import, the problem comes in when I import large numbers
> > > (17 – 20 characters long)… They should be imported as text, but they are
> > > importing as numbers, so they appear as scientific notation… When I go to
> > > create a file from the data, the numbers are being written in the scientific
> > > notation and not as text…
> > >
> > > I am unable to control the content of the XML file. I do know the number is
> > > in a certain column…
> > >
> > > Also, when I double click on a cell, I can edit it and place a single quote
> > > and it will store the number correctly… But, when I do it through automation,
> > > it won’t convert…
> > >
> > > We are using excel 2003… In the process of upgrading to 2007, but won’t be
> > > for another 6 months…
> > >
> > > Fustrating...
> > >
> > > Your help would be greatly appreciated..
> > >
> > > Thanks,
> > > Michael

> >
> > --
> >
> > Dave Peterson
> > .
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid scientific notation in my number field =?Utf-8?B?UGF0?= Microsoft Access External Data 2 1st Nov 2007 07:22 PM
Re: Number Formatting/Scientific notation Dave Peterson Microsoft Excel Misc 0 19th Jan 2007 08:55 PM
RE: Text field converting to scientific notation in Access Graph =?Utf-8?B?TEpQ?= Microsoft Access Reports 0 19th Jan 2007 01:49 AM
string format number of leading 0 in exponent in scientific notation Robert Ludig Microsoft Dot NET Framework 2 25th Sep 2006 04:57 PM
convert scientific notation to a number =?Utf-8?B?UGV0ZXI=?= Microsoft Excel Misc 1 4th Jan 2005 07:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:55 AM.