Microsoft KB Archive/68914

= Fields May Save Incorrectly in dBASE Formats from Excel =

Article ID: 68914

Article Last Modified on 11/16/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition
 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q68914





SUMMARY
When you save a Microsoft Excel worksheet in a dBASE format (*.DBF), field values may convert incorrectly, depending on the column width and the value of the first record in a field.



If the First Record in a Field Is a Text Value
Text values in these fields are truncated to a number of characters corresponding to the column width of the field. For example, if the column width is set to 5, and a record field contains the text &quot;abcdefgh,&quot; the text will be truncated to &quot;abcde&quot; when saved as a .DBF file.

If numbers are formatted as Text, they will revert back to the Number format and be right justified. Numbers entered with an apostrophe before it will revert to numbers and will be left justified.

If the first record of a field is blank, Microsoft Excel treats it as a text field. This is true even when all other records (blank or not) in that field are formatted as numeric.

Numeric entries in these fields will convert differently, depending on the column width:


 * 1) If the column is wide enough to display the number, the number will be converted to text in the DBF format. If the number is formatted as &quot;General&quot; or &quot;0,&quot; it will also be rounded to an integer before being converted to text.
 * 2) If the column is not wide enough to display the number, it will display &quot;#&quot; symbols instead. In the DBF format, this value will be saved as a string of &quot;#&quot; symbols. For example, if a field record has a value of 1234567, and the column width is set to 4, Microsoft Excel displays &quot;####&quot;. In the DBF format, this value will be saved as &quot;####&quot;.

Note that field names are NOT truncated unless they are more than 10 characters long. dBase imposes a limit of 10 characters on a field name.

If the First Record in a Field Is a Numeric Value
All other records in these fields are assumed to be numeric also. Any records in these fields that contain text values will be lost when saved in a DBF format. These records will be blank when the file is reopened.

Numeric values in these fields will convert as follows:


 * 1) If the column width is wide enough to display the number, it will be saved as a number. If the number format is &quot;General&quot; or &quot;0,&quot; the number will be rounded to an integer first.
 * 2) If the column is not wide enough to display the number, it will be lost when saved in the DBF format and the record will be blank when the file is reopened. This may also result in the error message &quot;Unable to read file&quot; when trying to reopen the DBF file.

In addition, if the records are not contiguous, you may lose data when saving the data in a DBF format. Any changes made to a DBF file after the initial save, may not be saved.

Additional query words: XL

Keywords: kbprb KB68914

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.