Fields May Save Incorrectly in dBASE Formats from Excel

Last reviewed: July 2, 1996
Article ID: Q68914

The information in this article applies to:

  • Microsoft Excel for Windows, version 2.x, 3.x, 4.x, 5.0, 5.0c
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, version 7.0

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.

MORE INFORMATION

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 "abcdefgh," the text will be truncated to "abcde" 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 "General" or "0," 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 "#" symbols instead. In the DBF format, this value will be saved as a string of "#" symbols. For example, if a field record has a value of 1234567, and the column width is set to 4, Microsoft Excel displays "####". In the DBF format, this value will be saved as "####".

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 "General" or "0," 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 "Unable to read file" 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.


KBCategory: kbfasttip
KBSubcategory:

Additional reference words: 7.00 5.00 2.00 2.01 2.10 2.20 2.21 3.00 4.00
decimal round


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 2, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.