Bug 140050 - Do not autoformat numbers in brackets
Summary: Do not autoformat numbers in brackets
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsUXEval
Depends on:
Blocks:
 
Reported: 2021-02-01 07:58 UTC by Heiko Tietze
Modified: 2021-02-01 16:28 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heiko Tietze 2021-02-01 07:58:12 UTC
Entering a number in brackets converts it into the negative value. Like (1) becomes -1. Without an option to switch this feature off one has to add a single quote to ensure the entered content is text, eg. '(1).

The number in bracket format comes from accounting to better distinguish the negative from positive numbers. But I understand it as the other way around, negative numbers are shown differently. See also https://ask.libreoffice.org/en/question/192076/negative-numbers-in-brackets/

I would expect a number format that is applied automatically when the number is entered in brackets.
Comment 1 V Stuart Foote 2021-02-01 14:38:47 UTC
@Heiko, having trouble following what you are asking.

And the ASK question was answered in its duplicate: 
https://ask.libreoffice.org/en/question/191894/how-do-you-bracket-negatives-in-calc/

Is this for Calc? Seems like it, and if so the cell formatting is controllable by Format Code pattern matching (for input and display) and can be adjusted already for representing negative numbers.

If the question is to hold a number in a text string--i.e. bound within brackets/parenthesis--it is no longer a number.  The correct entry for entering a NAN parenthesis bracketed text string in Calc *is* '(15.43).

Other brackets are not parsed, so [15.43] or {15.43} are treated as NAN text strings.

Not seeing an issue.
Comment 2 Heiko Tietze 2021-02-01 14:45:17 UTC
(In reply to V Stuart Foote from comment #1)
> Other brackets are not parsed, so [15.43] or {15.43} are treated as NAN text
> strings.

I don't get the point of converting round brackets. (1) is text - or rather should be.
Comment 3 V Stuart Foote 2021-02-01 15:25:21 UTC
(In reply to Heiko Tietze from comment #2)
> (In reply to V Stuart Foote from comment #1)
> > Other brackets are not parsed, so [15.43] or {15.43} are treated as NAN text
> > strings.
> 
> I don't get the point of converting round brackets. (1) is text - or rather
> should be.

OMG, No! This is Calc, it fundamentally deals with Numbers and formulas. Not text. 

Parenthesis brackets are accepted norm for the *value* input of negative numbers. As such they are hardcoded in Calc's edit shell, just like prepending a hyphen.

The exception, and out of scope use is NAN text strings.  That use is appropriately escaped just like other NAN input. 

End of story.
Comment 4 Heiko Tietze 2021-02-01 15:30:51 UTC
(In reply to V Stuart Foote from comment #3)
> Parenthesis brackets are accepted norm for the *value* input of negative
> numbers.

And that's the question here. Why? And where? Again: I understand parentheses as better or rather alternative indicator but this functions turns it around. What is the use case (beyond confusing Benjamin users) to convert (1) into -1?
Comment 5 V Stuart Foote 2021-02-01 15:58:07 UTC
(In reply to Heiko Tietze from comment #4)
> (In reply to V Stuart Foote from comment #3)
> > Parenthesis brackets are accepted norm for the *value* input of negative
> > numbers.
> 
> And that's the question here. Why? And where? Again: I understand
> parentheses as better or rather alternative indicator but this functions
> turns it around. What is the use case (beyond confusing Benjamin users) to
> convert (1) into -1?

It is a standard spreadsheet number entry format, when you enter (1) you are entering a negative 1.0

You can format Calc's display of negative numbers so entry can continue to be represented as (1).  But it is still a negative 1.0; that is what is entered.

Treating it as NAN requires use of the prepended apostrophe.
Comment 6 Mike Kaganski 2021-02-01 16:28:47 UTC
Heiko:

It's absolutely correct that Calc tries to convert entered string to a number when a cell is not pre-formatted as text.
It's absolutely OK that it tries everything it can to convert it, including treating numeric literal in parentheses as a negative number.
It is not OK to introduce multiple configurations. Your proposal just tries to disable one of possible matches; so let's continue with another switch "do not convert strings starting with minus"; "do not convert if it's ISO date"; "do not convert if it has $ (but do if it has €)", etc.

The proper way to work with Calc is to rely on its automatic conversion wherever possible, and where you want your entry to be treated as text unconditionally, use Text cell format prior to entry. Telling "I use all cells formatted to auto-detect, but want it to understand what I want it not to be number" is a user error.