Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenMon, 26 May 2014 09:33:01 +0200Test number for 2^x in Calchttps://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.
Can you help me find this functionality?
Thanks, DickWed, 03 Apr 2013 19:56:10 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/Comment by JohnSUN for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15698#post-id-15698Do you mean functions BITAND() and BITOR()?Thu, 04 Apr 2013 09:03:37 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15698#post-id-15698Comment by rcw for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15727#post-id-15727Thanks for your time. Yes this sounds just right. However BITAND() is not listed in functions and BITAND() returns #NAME? for me in LibreOffice 3.4.3
OOO340m1 (Build:302). Is there an extension to download? Thanks again.Fri, 05 Apr 2013 01:29:26 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15727#post-id-15727Comment by rcw for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15759#post-id-15759I installed LibreOffice Version 3.6.5.2 as itsGetting started doc stated it had added BITx as declared in the ODF 1.2 specification." Tested BITAND() and it works fine. However the new LibreOffice download seemed to require Torrent if I didn't want to build my own downloader. I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL! If you prefer to avoid that the text solution works, otherwise BITAND() is cleaner. Thanks to JohnSUN and mariosv.Fri, 05 Apr 2013 18:22:38 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15759#post-id-15759Comment by JohnSUN for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15739#post-id-15739Yes, I didn't found a description of these functions in the Help too. I stumbled upon them in LibreOffice 4.0.1 (There are description of these functions is in the help of HelpPack )Fri, 05 Apr 2013 08:46:42 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15739#post-id-15739Answer by m.a.riosv for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15682#post-id-15682Only one equal for comparisons in calc.
You can do:
=(2^2)=4
Wed, 03 Apr 2013 21:42:49 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15682#post-id-15682Comment by rcw for <p>Only one equal for comparisons in calc. <br>
You can do: <br>
=(2^2)=4 </p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15685#post-id-156852^2+2^4=20. I was looking for the test: Does number (example 20) contain a 4? In binary, 00100+10000=10100. I am trying to test for the binary position. This can be used for a mask or as a flag.Wed, 03 Apr 2013 23:11:37 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15685#post-id-15685Answer by m.a.riosv for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15689#post-id-15689Forgive me rcw, I have misunderstood your question.
Next screenshot shows one way to find if a binary is inside other, using the SEARCH() function which allow regular expression, substituting the zeroes with point (any character) adding the "$" (to find at the end).
=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2))))
![image description](/upfiles/13650383447804377.png)Thu, 04 Apr 2013 03:24:50 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15689#post-id-15689Comment by rcw for <p>Forgive me rcw, I have misunderstood your question.</p>
<p>Next screenshot shows one way to find if a binary is inside other, using the SEARCH() function which allow regular expression, substituting the zeroes with point (any character) adding the "$" (to find at the end).</p>
<p>=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2))))</p>
<p><img alt="image description" src="/upfiles/13650383447804377.png"></p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15725#post-id-15725Thanks for your time. This text solution works for all but case "0" where it always returns True. If I can't get a math method running this will work. Thanks again.Fri, 05 Apr 2013 01:24:42 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15725#post-id-15725Comment by rcw for <p>Forgive me rcw, I have misunderstood your question.</p>
<p>Next screenshot shows one way to find if a binary is inside other, using the SEARCH() function which allow regular expression, substituting the zeroes with point (any character) adding the "$" (to find at the end).</p>
<p>=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2))))</p>
<p><img alt="image description" src="/upfiles/13650383447804377.png"></p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15734#post-id-15734Yes, Thank you very much. DickFri, 05 Apr 2013 04:44:08 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15734#post-id-15734Comment by m.a.riosv for <p>Forgive me rcw, I have misunderstood your question.</p>
<p>Next screenshot shows one way to find if a binary is inside other, using the SEARCH() function which allow regular expression, substituting the zeroes with point (any character) adding the "$" (to find at the end).</p>
<p>=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2))))</p>
<p><img alt="image description" src="/upfiles/13650383447804377.png"></p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15732#post-id-15732A simple solution: =IF(B3;Formula;0), can solve the 0 issue.Fri, 05 Apr 2013 03:42:26 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15732#post-id-15732Answer by rcw for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15763#post-id-15763Use BITAND() to test for binary values. Your version of LibreOffice must be 3.6 or greater.
TRUE=BITAND(4,20) - from JohnSUN
Previous to version 3.6 use this text based test
=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2)))) using =IF(B3;Formula;0) to prevent a search for 0 returning a TRUE - from mariosv
Comment:
I installed LibreOffice Version 3.6.5.2 as itsGetting started doc stated it had added BITx as declared in the ODF 1.2 specification." The new LibreOffice download seemed to require Torrent if I didn't want to build my own downloader. **I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL!**
***I recently (Version 4.2.0.4) tested =BITAND($B14,4), =BITAND($G17,2^2), and =IF(BITAND($L17,2^2),1,0) which returned 4, 4, and 1. All work depending on the form of the test and desired answer.***
Thanks to JohnSUN and mariosv.Fri, 05 Apr 2013 20:47:45 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15763#post-id-15763Comment by rcw for <p>Use BITAND() to test for binary values. Your version of LibreOffice must be 3.6 or greater.
TRUE=BITAND(4,20) - from JohnSUN
Previous to version 3.6 use this text based test
=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2)))) using =IF(B3;Formula;0) to prevent a search for 0 returning a TRUE - from mariosv</p>
<p>Comment:
I installed LibreOffice Version 3.6.5.2 as itsGetting started doc stated it had added BITx as declared in the ODF 1.2 specification." The new LibreOffice download seemed to require Torrent if I didn't want to build my own downloader. <strong>I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL!</strong> </p>
<p><strong><em>I recently (Version 4.2.0.4) tested =BITAND($B14,4), =BITAND($G17,2^2), and =IF(BITAND($L17,2^2),1,0) which returned 4, 4, and 1. All work depending on the form of the test and desired answer.</em></strong>
Thanks to JohnSUN and mariosv.</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15818#post-id-15818Looking at the the download page I now see that Main Installer, torrent, and Info are different choices. As they are all inside a big green box I did not notice the different links until you said I should be able to not use torrent. Sigh. Thanks for your time.Sun, 07 Apr 2013 22:12:48 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15818#post-id-15818Comment by qubit for <p>Use BITAND() to test for binary values. Your version of LibreOffice must be 3.6 or greater.
TRUE=BITAND(4,20) - from JohnSUN
Previous to version 3.6 use this text based test
=NOT(ISERROR(SEARCH(SUBSTITUTE(BASE(4;2);"0";".")&"$";BASE(109;2)))) using =IF(B3;Formula;0) to prevent a search for 0 returning a TRUE - from mariosv</p>
<p>Comment:
I installed LibreOffice Version 3.6.5.2 as itsGetting started doc stated it had added BITx as declared in the ODF 1.2 specification." The new LibreOffice download seemed to require Torrent if I didn't want to build my own downloader. <strong>I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL!</strong> </p>
<p><strong><em>I recently (Version 4.2.0.4) tested =BITAND($B14,4), =BITAND($G17,2^2), and =IF(BITAND($L17,2^2),1,0) which returned 4, 4, and 1. All work depending on the form of the test and desired answer.</em></strong>
Thanks to JohnSUN and mariosv.</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15771#post-id-15771Hi @rcw,
I'm not sure what platform you're using, but you should be able to grab the latest build of LibreOffice on [the download page](https://www.libreoffice.org/download/) without using bittorrent. Please try clicking on the text that reads *Main installer*, or (if you'd like to choose a different language or OS) click on *[Change System, Version or Language](https://www.libreoffice.org/download/?nodetect)*.
Thanks!Sat, 06 Apr 2013 06:51:23 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15771#post-id-15771Answer by ROSt52 for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15824#post-id-15824As we have 2 topics under this question my answer concerns @rcw's comment
> I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL!
I feel that the current button to download LibO or LibO help files is a bit confusing. I also was once confronted with a torrent file and found later accidentally that the download button contains 2 versions:
![image description](/upfiles/13653850991934575.gif)
Depending on where you click you a msi-file or torrent-file download starts.
This is done with Windows version.
Mon, 08 Apr 2013 03:40:24 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=15824#post-id-15824Comment by ROSt52 for <p>As we have 2 topics under this question my answer concerns <a href="/en/users/4199/rcw/">@rcw</a>'s comment</p>
<blockquote>
<p>I DID NOT LIKE THE EXPERIENCE OF GETTING RID OF uTORRENT AT ALL!</p>
</blockquote>
<p>I feel that the current button to download LibO or LibO help files is a bit confusing. I also was once confronted with a torrent file and found later accidentally that the download button contains 2 versions:</p>
<p><img alt="image description" src="/upfiles/13653850991934575.gif"> </p>
<p>Depending on where you click you a msi-file or torrent-file download starts.</p>
<p>This is done with Windows version.</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15883#post-id-15883An enhancement request is filed. Please feel free to add comments to enable better judgment.
https://bugs.freedesktop.org/show_bug.cgi?id=63287Tue, 09 Apr 2013 06:32:28 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?comment=15883#post-id-15883Answer by Lupp for <p>In many languages you can test (2^x)==y to see if y contains a 4 for example. Or you can pull out a 0 or 4 with (2^2)&y.</p>
<p>Can you help me find this functionality?</p>
<p>Thanks, Dick</p>
https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=34589#post-id-34589As "rcw" recently updated this post:
If someone still is using old versions of Calc not containing the bit operation functions for some reason:
=ISODD(QUOTIENT({ValueToTest};{PowerOf2})) is a compact alternative to the formerly suggested text oriented solutions.
Using versions containing the bit functions the formula
=QUOTIENT({ValueToTest};{Base}^{Exponent})-QUOTIENT(CURRENT();{Base}) * {Base}
can still be used where the base for whose powers should be tested is not 2 but another integer number.
Sorry, the last formula was erroneous in the first post of this answer. It was rectified by editing.Mon, 26 May 2014 09:33:01 +0200https://ask.libreoffice.org/en/question/15675/test-number-for-2x-in-calc/?answer=34589#post-id-34589