Bug 99789 - Formula does not calculate due to prior Format Cell as Text, despite Format Cell as Number
Summary: Formula does not calculate due to prior Format Cell as Text, despite Format C...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.1.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-12 04:03 UTC by walkerkorea
Modified: 2017-02-16 14:24 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Formula not seen evaluated (9.14 KB, image/png)
2017-02-15 06:28 UTC, Ahamed
Details
The precedent cells are seen highlighted on double clicking (8.58 KB, image/png)
2017-02-15 06:30 UTC, Ahamed
Details

Note You need to log in before you can comment on or make changes to this bug.
Description walkerkorea 2016-05-12 04:03:15 UTC
Details : When a cell is formatted as category Text, it can never again calculate a formula automatically. Even if you reformat it as Numbers, or Date, or whatever, it refuses to calculate. 

Reproducible? :  Yes. Confirmed.

Steps to Reproduce : 

1. File / New / Spreadsheet or Ctrl-N to open new spreadsheet.
2. Select cell(s).
3. Press Ctrl-1 to format cell.
4. Choose Category "Text" and click OK.
5. Enter "=SUM(7,5)" or "=sum(7,5)" in a text cell (without quotes).
6. Select cell(s) with formula(e).
7. Press Ctrl-1.
8. Choose Category "Numbers" and click OK.

Actual Results : The text remains as it was, e.g., =SUM(7,5) .

Expected Results : The text formula instantly converts to the result of the calculated formula (12).

Additional Information : A couple times, I was able to choose Data / Calculate / Formula to Value, and got the Expected Results. This did not always work, however. At other times, Formula to Value was greyed out.

Copy/Paste Only/Formula (or Paste Special) doesn't seem to produce the Expected Results, either.

My only data is from this system, using Windows 10 (64 bit, running on AMD A10-7800). I've searched for duplicates, to no avail.
Comment 1 QA Administrators 2016-05-12 04:31:49 UTC
This isn't a bug. It works how it's intended to work. There is an enhancement request to bring text to number into LibreOffice core (currently it's an extension).

If a user goes to the extent of formatting a cell as text - of course LibreOffice is going to treat it like text.
Comment 2 walkerkorea 2016-05-14 06:54:26 UTC
Is that you, Roy?  (The IT Crowd reference)

So, you're claiming:
1. A cell becoming Text is always intentional.
2. Such a change should be irrevocable.

Both of these are false. Well, you can write software where #2 is true, but I doubt many users will appreciate a spreadsheet that cannot be modified more than once.

There are many ways for cells to become Text without that being intentional, even with power users of LO. Users can need something to be Text, but only temporarily, with the later intention of changing it to a date or a number. More commonly, any time you insert a row or column, LO is copying the propert(ies) of adjacent cells, and that's not always ideal. Users might have intended to have clicked on the item just before, and so accidentally convert a cell, row, column or entire sheet to Text, with no obvious change that they would quickly Undo from.

So, yes, any edit should be able to be changed again, with reversible results.

Otherwise, you have a cell that looks normal, like any other empty cell, but yet when you insert a number or formula, it doesn't work like one.

Btw, all the many "It's not a bug, it's a feature" replies are just disheartening for users like me who take our own time to research if it's already reported, and then report the bug.

Eventually, someone will take this serious enough to fix it. It's a HUGE issue for anyone who uses Text.

And, yes, of course I tried turning it off and back on!
Comment 3 Buovjaga 2016-10-21 18:43:30 UTC
Correcting status to unconfirmed.
Comment 4 Cor Nouws 2016-10-22 15:05:57 UTC
Hi Walker,

Added some reference issues..
Comment 5 Ahamed 2017-02-14 12:36:01 UTC
Hi all,
This problem is posing a going back to MS excel in my office. After an herculian effort only I could change the mood of the staff in my office towards Libreoffice.

We need a lot of calculations for the day2day office work.  At times, the cell shows only the equation.  It does not get updated.  If we double click the precedent cells are high lighted with colour bands.  It behaves as a text cell.  There is no ' character before the = sign.

I can repeat this like this,

0. let in the cell A3 there is an equation "=A1+A2" (of course no double quotes) gives the correct result by adding A1 and A2

1.put a ' character in the eqn. before = sign

2.convert the cell A3 to text using format cells

3.then remove the ' character ... it shows instead of the function value, the function as a text.

4.trying to convert back from text to number format does not yield the result.. it shows the eqn. rather than the value

Pl. let me know what is the workaround for this.  I am using Linux and 4.3.3.2 under debian.  In my office MS Winodws 8.0 with LibreOffice 5.2 also have the same problem.

Rasheed
Comment 6 Ahamed 2017-02-14 12:46:31 UTC
The behaviour is strange and i do not know how that happen in a document.pl. post a work around.
Comment 7 Cor Nouws 2017-02-14 15:07:24 UTC
Hi Ahmed,

(In reply to Ahamed from comment #6)
> The behaviour is strange and i do not know how that happen in a document.pl.
> post a work around.

How do you get a real life document where formulas are formatted like that?
But, if it's important, feel free to contact me to look at possibilities to extend CT2N to serve this very goal.
  https://extensions.libreoffice.org/extensions/ct2n-convert-text-to-number-and-dates
You may want to extend it yourself too, of course.

Hope that helps,
Cor
Comment 8 Cor Nouws 2017-02-14 15:08:53 UTC
I'm tempted to close as NotABug, by the way
Comment 9 Ahamed 2017-02-15 04:33:33 UTC
(In reply to Cor Nouws from comment #7)
> Hi Ahmed,
> 
> (In reply to Ahamed from comment #6)
> > The behaviour is strange and i do not know how that happen in a document.pl.
> > post a work around.
> 
> How do you get a real life document where formulas are formatted like that?
> But, if it's important, feel free to contact me to look at possibilities to
> extend CT2N to serve this very goal.
>  
> https://extensions.libreoffice.org/extensions/ct2n-convert-text-to-number-
> and-dates
> You may want to extend it yourself too, of course.
> 
> Hope that helps,
> Cor

Hi Cor Nouws,
appreciate for your immediate reply.  

The issue was while importing an XL document to Libreoffice and while entering an equation to find a result based on the data in some other cells, it showed only the equation rather than the result.  

I tried to reformat the cell using Ctl+1 back to number format but was in vain. Let me know what is the workaround for this.  

by the by, How to use that CT2N command

Ahamed
Comment 10 Ahamed 2017-02-15 06:28:59 UTC
Created attachment 131230 [details]
Formula not seen evaluated
Comment 11 Ahamed 2017-02-15 06:30:17 UTC
Created attachment 131231 [details]
The precedent cells are seen highlighted on double clicking

The precedent cells are seen highlighted on double clicking
Comment 12 Ahamed 2017-02-15 06:37:48 UTC
the CT2N extension does not give the formula back to the value instead it gives only formula itself.
Comment 13 Cor Nouws 2017-02-15 08:40:44 UTC
(In reply to Ahamed from comment #12)
> the CT2N extension does not give the formula back to the value instead it
> gives only formula itself.

That is what I wrote in comment #7 - sorry if that was not clear.
Comment 14 Buovjaga 2017-02-16 13:08:08 UTC
Closing per a Calc dev's feedback: "applying display formats never changes cell content"
Comment 15 Eike Rathke 2017-02-16 14:24:12 UTC
For clarification: if a cell is already formatted to Text, any new cell input is forced to text content, no number, date or formula recognition is attempted. This is on purpose and works similar across major spreadsheet applications.

As changing the cell format does not change the cell content, to force a new interpretation of content as formula first select the cell range in question, then change the cell format to General, then, with the selection still in place, use Find&Replace (Ctrl+H):
Find: =
Replace: =
verify that under Options the Selection only is checked
and hit Replace All.