Bug 64001 - Boolean TRUE and FALSE value cells not treated correctly in AutoFill
Summary: Boolean TRUE and FALSE value cells not treated correctly in AutoFill
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: lowest normal
Assignee: Eike Rathke
URL:
Whiteboard: target:5.3.0 target:6.1.0 target:7.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-27 17:50 UTC by Horst
Modified: 2021-03-12 11:39 UTC (History)
3 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 Horst 2013-04-27 17:50:39 UTC
1) Type TRUE in cell A1
2) Autofill/drag A1 to A10, all cells show TRUE
3) Type FALSE in A11
4) Enter in B1: =COUNTIF(A1:A11,TRUE) , hit enter
The formula changes to =COUNTIF(A1:A11,1) and displays result of 1 not 10.

If you reformat cells A1 to A11 as number (1234 not gerneral) they show 1,2,3,4..10,0.

Per definition FALSE is 0, TRUE is any number not equal 0.

The correct change of the COUNTIF function has to be =COUNTIF(A1:A11,"<>0") or leave TRUE in place.
Comment 2 Owen Genat (retired) 2013-11-18 04:02:18 UTC
Confirmed under Ubuntu 10.04 x86_64 running v4.1.3.2 Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a. Status set to NEW. Severity set to Normal as there are viable workarounds.

To be clear, as per the AskLO discussion linked in comment #1, it is only Fill Series (click-n-drag unmodified / CTRL+3 with increment of 1) rather than Fill Down (click-n-drag with CTRL modifier / CTRL+D) that causes the problem.
Comment 3 GerardF 2013-11-18 08:28:46 UTC
The string TRUE is turned into 1 while typing, dragging down increments this number. (Holding the Ctrl key while typing is a workarround).
Booleans in OOo and LibO are not true booleans but numbers with specific format.

Typing =TRUE() and dragging produces the expected result (TRUE in all rows as you drag a formula , not a number).

Writing a string and rely on number recognition is not the best way to have the boolean value. Don't forget that number recognition is locale dependant (TRUE in EN, VRAI in FR...etc). So the best way is to use TRUE() and FALSE() formula.
Comment 4 Owen Genat (retired) 2013-11-18 09:09:25 UTC
(In reply to comment #3)
> Writing a string and rely on number recognition is not the best way to have
> the boolean value. Don't forget that number recognition is locale dependant
> (TRUE in EN, VRAI in FR...etc). So the best way is to use TRUE() and FALSE()
> formula.

Thanks for the clarification. Given this information, I agree. This report would therefore seem more an enhancement request (if anything) than bug. Added missing "T" to "COUNTIF" in summary.
Comment 5 Ady 2013-11-19 02:38:59 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Writing a string and rely on number recognition is not the best way to have
> > the boolean value. Don't forget that number recognition is locale dependant
> > (TRUE in EN, VRAI in FR...etc). So the best way is to use TRUE() and FALSE()
> > formula.
> 
> Thanks for the clarification. Given this information, I agree. This report
> would therefore seem more an enhancement request (if anything) than bug.
> Added missing "T" to "COUNTIF" in summary.

Should this report be set as enhancement request? Or perhaps even closed?

For now, I'm lowering priority and setting as enhancement request, since alternative or more adequate procedures already exists (using "=true()" among others). If there are reasons to change the status, feel free to change it accordingly.

Regards,
Ady.
Comment 6 Owen Genat (retired) 2013-11-19 09:24:23 UTC
(In reply to comment #5)
> Should this report be set as enhancement request? Or perhaps even closed?

I think it could be closed as WONTFIX, but it would be good to hear from the original reporter.
Comment 7 Horst 2013-11-19 16:01:36 UTC
This bug is in my opinion NOT an enhancement. It is a real bug.

The Autofill just enters numbers incrementally in cells which is correct per OASIS definition (and all programming languages I know). The error is inside of the COUNTIF function.

I gave the solution in my original report.
>The correct change of the COUNTIF function has to be =COUNTIF(A1:A11,"<>0") or >leave TRUE in place.

I can not estimate how much work the change from "1" to "<>0" in the COUNTIF function is.

If it is too much work then let it be a WON'T FIX.

I changed it back to NORMAL from ENHANCEMENT.
Comment 8 QA Administrators 2015-04-19 03:23:05 UTC Comment hidden (obsolete)
Comment 9 Buovjaga 2015-06-18 16:56:46 UTC
Countif gives #NAME? result for me.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 437210d58f32177ef1829d704f7f4d2f1bbfbfdd
TinderBox: Win-x86@39, Branch:master, Time: 2015-06-18_07:21:56
Locale: fi-FI (fi_FI)
Comment 10 QA Administrators 2016-09-20 10:11:24 UTC Comment hidden (obsolete)
Comment 11 Commit Notification 2016-10-31 17:15:13 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d7984d88e6e611e84fef41e7bb092c127b5db26b

Resolves: tdf#64001 exclude "boolean" value cells from increment during Fill

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2018-05-06 18:23:19 UTC
Zdeněk Crhonek committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=90f6876bec3989e3fc8e4f961604c8d00e735eb9

uitest for bug tdf#64001

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 raal 2019-12-07 19:18:16 UTC
The test exist, set status to Verified.
Comment 14 Commit Notification 2021-03-12 11:39:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3eac1691aae5d788269c538fbf609e625fac0c84

tdf#64001: sc: move UItest to CppUnittest

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.