Microsoft Excel has a =LET()
function, which from my understanding allows one to assign names to variables. One use case is avoiding lengthy repetition within a formula. Does LibreOffice Calc have a similar function?
try
https://help.libreoffice.org/6.4/en-US/text/sbasic/shared/01020100.html?DbPAR=BASIC
https://help.libreoffice.org/3.3/Basic/Using_Variables
Thanks, @AdmFubar. Iāll certainly look into it, though Iām not too familiar with LibreOffice Basic. I was also hoping to find an in-cell function or formula.
Those actually interested may visit http://psilosoph.de/FreeOfficeRequests/.
They will find an explaining text there, and a nearly 4 years old partial and provisional solution (which actually worked in examples).
Years later I was lead back here by a special notice and found the link broken.
Once more emphasizing that the suggested āsolutionā was just an experimetal proof of concept, I upload here the relevant example from the broken link and a short related plain text:
KeepInMemory0.1.ods (20.0 KB)
toAfewContributors.odt (2.6 KB)
Concerning the ābackstage memoryā I would now prefer a different approach but due to age Iām not confident there will be āprivate developmentā in that direction by myself.
Below the next to unchanged part of the old post.
Recently I reconsidered the topic superficially. However, there are some facts not making me fond of expending much time on this. Mainly:
- Next to nobody seems to need it.
- The provisional solution is too fainthearted.
- The gain in efficiency may be minimal, partly due to the usage of Basic, partly to the fact that the efficiency of expensive calculations was improved in Calc.
- A really adequate usage beyond the most obvious cases may prove to be somehow fragile or error-prone.
There is also a temptation to ārevive the projectā: The provisional LET()
function of Excel365 may be a flop. In specific the second example from the page @erAck linked to is more of an offence than of an offer, imo.
(Donāt prematurely start to use my provisional code.)
The advantage it has is that the sub-expression FILTER(A2:D8,A2:A8="Fred")
occurs only once and has to be executed/calculated only once, the second occurrence of filteredRange reusing the result of the first occurrence (or at least thatās what Iād hope how itās implementedā¦) which may make a difference in large range calculations.
Yes, of course. Did you glance through my provisional āimplementationā: I would prefer to not rule the feature by a function like LET() disposing the helper variable autoamtically on leave, but by a couple of functions applicable much more flexible.
I edited my main comment above.
Good news: as of release 24.8, there is a LET() function available in Calc!
(Sorry for the necroāing, but this QA was the first result when I searched for this)
No, LET() is not implemented.
(for the curious: MS365 beta feature LET function - Office Support)
Hereās the bug tracking this feature request: