Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenMon, 14 Dec 2015 21:54:50 +0100If statement with arithmatichttps://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/I'm using Libre Calc but for some reason the following always produces the string `TRUE`
=IF(K3="",D3,D3*K3)
What I want is if Cell K3 is empty, then print the value of Cell D3, otherwise print the value of D3 multiplied with K3.
What am I doing wrong?
Sat, 12 Dec 2015 23:35:52 +0100https://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/Answer by Edward for <p>I'm using Libre Calc but for some reason the following always produces the string <code>TRUE</code></p>
<pre><code>=IF(K3="",D3,D3*K3)
</code></pre>
<p>What I want is if Cell K3 is empty, then print the value of Cell D3, otherwise print the value of D3 multiplied with K3.</p>
<p>What am I doing wrong?</p>
https://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/?answer=61980#post-id-61980Formula looks correct. If cell is formatted as Boolean Value formula will return "TRUE", formatting cell as number should fix the issue.Mon, 14 Dec 2015 21:15:44 +0100https://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/?answer=61980#post-id-61980Answer by Lupp for <p>I'm using Libre Calc but for some reason the following always produces the string <code>TRUE</code></p>
<pre><code>=IF(K3="",D3,D3*K3)
</code></pre>
<p>What I want is if Cell K3 is empty, then print the value of Cell D3, otherwise print the value of D3 multiplied with K3.</p>
<p>What am I doing wrong?</p>
https://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/?answer=61982#post-id-61982What is called "the string TRUE" by the OP is not a string (text) but the way Calc displays a numerical value in a cell set to the number format 'BOOLEAN' (listed as 'Boolean value'). It may be heavily misleading but is a fact that Calc displays TRUE for any value not equal to 0 an FALSE for the value 0 only in this case. [Let K3 be 0 to experience this.]
The second misleading behaviour of Calc in this context is that it automatically applies the number format BOOLEAN to a cell if it has the number format 'General' in advance and is recalculated to the result of a BOOLEAN function.
The third craziness I see in the fact that a cell once formatted this way will display every numeric result as 'BOOLEAN' even if the formula was edited to something without any relation to logic, "=PI()/8", eg.
And the fourth incredibility (or was it the zeroth) is that **an IF function is classified logical if the third or both the second and the third parameters are missing.** It will produce the logical result of the condition as its own result for the missing parameter. Very bad.
@johnlai2004 , for some reason, most likely because of a typo, **had first entered an incomplete IF expression**. Then he rectified that. This did not heal the consequences of silly smart automatisms.
You see?
@Edward is right in principle. We get rid of the insistent wrong format by choosing **another** numeric format but 'BOOLEAN'. 'BOOLEAN', however, is also a number format. I cannot but accept that.
By the way: Entering a numeric constant into the cell will also switch off the BOOLENA hysteria.
Mon, 14 Dec 2015 21:54:50 +0100https://ask.libreoffice.org/en/question/61905/if-statement-with-arithmatic/?answer=61982#post-id-61982