Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


On 12/03/2011 04:39 PM, David S. Crampton wrote:
Expanding a bit on Jonny's concatenation:

A1: "" (null string)
A2: 1 (numeric)
A3: =A1+A2 displays #VALUE
A4: =A1 & A2 displays left-aligned "1". It is a text result.
A5: =A2 + A4 displays a right-aligned 2. It is a numeric result.

Ergo, the "+" operator gave #VALUE result when combining a null string and a numeric but gives a numeric when combining a <text string which can be interpreted as a numeric> with a numeric.

Per my mini-sermon (earlier today) on debugging and preferring strict type-based behavior, I would prefer A5 to also display #VALUE.
The default behavior appears to be an implicit type conversion of string to a numeric data type when it is possible. Either to an integer or decimal as needed. I tried your test using 1.356 (US format) in A2 and got

A# = #VALUE
A4 = 1.356 as string (left justified)
A5 = 2.356 as decimal (right justified)

If the there is any character that can not implicitly convert to a number, an error is thrown. This probably dates back to the original spreadsheets (Visicalc and Lotus 123). For consistency one must follow some of the original, even if stupid, decisions so the average user is not confused and spreadsheets can be easily imported into other spreadsheet programs.

--
Jay Lozier
jslozier@gmail.com


--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.