View Single Post
 
Old 01-29-2014, 03:52 PM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Raje, are you saying that when you open a .csv file in Excel, you're losing some precision? The VBA language has different data types that require more or less bytes of storage, but I'm not aware that Excel does that; I think every cell's numeric value has the same precision, no matter what of numeric data is in there.

I can imagine writing a VBA program that would a) read a .csv file as text, b) look at each incoming value to see how many digits of precision it has, c) store that value in the correct datatype (eg Integer, Long or LongLong) and finally d) copy the imported value into an Excel worksheet. But as soon as the data is placed in Excel, isn't the result going to be exactly the same?

If you think you're losing precision, please post a copy of an example, a .csv file that can't be read into Excel 2010 without losing digits. I can easily believe that; but I think my response is going to be "but you were losing precision when you read it into Excel 2003 too". Maybe it let you set the data type when you read it in (though I don't remember it), but the internal storage was the same in all cases.

One possibility: Are you sure you're not thinking of text importing? There, yes, you can tell Excel what sort of data you're reading in—text, dates, or "General"—but even there you're not talking about different precisions.
Reply With Quote