Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hello,

I need to code a set of functions in calc that would translate to
something like this in a programming language:

b = (a + 5) * 6
b += (25 + b - 6) % 14

This can be implemented in two ways:

Way 1 which works but uses additional cells:

Cell A2 contains the value of "a"
Cell B2 = (A2+5)*6
Cell B3 = B2+MOD(25+B2-6;14)

If a is equal to 25, cell B3 now contains the value 183, which is the
expected result.

Way 2 which does not work all the time:

Cell A2 contains the value of "a"
Cell B2 set to =(A2+5)*6+MOD(25+CURRENT()-6;14)
Again, if a is equal to 25, cell B2 is now equal to 182!

Additionally, setting B2 to the following formulae yields these results:

=(A2+5)*6+MOD(25-6+CURRENT();14)  -> 190
=(A2+5)*6+MOD(CURRENT()+25-6;14) -> 183 (expected result)
=(A2+5)*6+MOD(-6+CURRENT()+25;14) -> 193

The help indicates that CURRENT() "Calculates the current value of a
formula at the actual position". However, since the CURRENT() is inside
the MOD() function, the value of the formula should not be influenced by
the position of the function since the value of the formula should not
change before the MOD() is calculated. Or is there something I am
missing? Thank you for your help. I use LibreOffice Version 4.3.7.2
Build ID 4.3.7.2-6.fc21 on Fedora, with a French language pack.

Best regards,

Rémy Gauthier.



-- 
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.