Ask LibreOffice - RSS feedhttps://ask.libreoffice.org/en/questions/Questions and answers for LibreOfficeenTue, 19 Jul 2016 23:06:48 +0200Can we use regular spreadsheet functions in Basic functions?https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/For example, can Vlookup be included in a Basic function/ And if so, what is the format to use?
Would it be =vlookup(w,x,y,z) or =vlookup(w;x;y;z) ?
And is there something that needs to precede the function name? Thanks.Tue, 07 Jan 2014 20:33:16 +0100https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/Answer by sargdavid for <p>For example, can Vlookup be included in a Basic function/ And if so, what is the format to use? <br>
Would it be =vlookup(w,x,y,z) or =vlookup(w;x;y;z) ?</p>
<p>And is there something that needs to precede the function name? Thanks.</p>
https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?answer=28052#post-id-28052I think this this should answer your question:
[http://www.oooforum.org/forum/viewtopic.phtml?t=24943](http://www.oooforum.org/forum/viewtopic.phtml?t=24943)
Tue, 07 Jan 2014 21:04:33 +0100https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?answer=28052#post-id-28052Answer by Regina for <p>For example, can Vlookup be included in a Basic function/ And if so, what is the format to use? <br>
Would it be =vlookup(w,x,y,z) or =vlookup(w;x;y;z) ?</p>
<p>And is there something that needs to precede the function name? Thanks.</p>
https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?answer=28051#post-id-28051Yes. Example:
<pre><code>
function MYFKT (byVal x as double) as double
dim oFunction as variant
oFunction = createUnoService("com.sun.star.sheet.FunctionAccess")
dim aArgument(2) as variant
dim result as double
aArgument(0)=x
aArgument(1)=2
aArgument(2)=3
result = oFunction.callFunction( "FDIST", aArgument() )
MYFKT = result
end function
</code></pre>Tue, 07 Jan 2014 21:01:34 +0100https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?answer=28051#post-id-28051Comment by Adobe for <p>Yes. Example:</p>
<pre><code>
function MYFKT (byVal x as double) as double
dim oFunction as variant
oFunction = createUnoService("com.sun.star.sheet.FunctionAccess")
dim aArgument(2) as variant
dim result as double
aArgument(0)=x
aArgument(1)=2
aArgument(2)=3
result = oFunction.callFunction( "FDIST", aArgument() )
MYFKT = result
end function
</code></pre>
https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?comment=73579#post-id-73579This is more of a [currying](https://en.wikipedia.org/wiki/Currying) than a function.Tue, 19 Jul 2016 23:06:48 +0200https://ask.libreoffice.org/en/question/28048/can-we-use-regular-spreadsheet-functions-in-basic-functions/?comment=73579#post-id-73579