Hilfe für LibreOffice 24.8
Zusätzlich zu den nativen BASIC-Funktionen können Sie Calc-Funktionen in Ihren Makros und Skripten aufrufen und Calc-Funktionen in Zellformeln setzen.
Verwenden Sie die Funktion CreateUnoService, um auf den Dienst com.sun.star.sheet.FunctionAccess zuzugreifen.
Das folgende Beispiel erstellt eine Funktion namens MyVlook, welche die Calc-Funktion SVERWEIS über ein als Argument übergebenes Datenarray aufruft und den von der Funktion gefundenen Wert zurückgibt.
    Function MyVlook(Lookup, DataArray As Object, Index As Integer, SortedRangeLookup as Byte)
        Dim oService As Object
        Set oService = CreateUnoService("com.sun.star.sheet.FunctionAccess")
        ' Verwenden Sie den Funktionsnamen immer auf Englisch
        MyVlook = oService.callFunction("VLOOKUP", Array(Lookup, DataArray, Index, SortedRangeLookup))
    End Function
  Das folgende Makro zeigt ein Beispiel dafür, wie die Funktion MyVlook aufgerufen werden kann. Es erstellt zuerst eine 5-mal-2-Datenmatrix, ruft dann die Funktion MyVlook auf und zeigt den zurückgegebenen Wert mit MsgBox an.
    Sub CallingMyVlook()
        ' Erstellt ein 5 x 2 Array und füllt es mit Daten
        Dim myData(1 to 5, 1 to 2) as Variant
        myData(1, 1) = 1 : myData(1, 2) = "Stimme überhaupt nicht zu"
        myData(2, 1) = 3 : myData(2, 2) = "Stimme nicht zu"
        myData(3, 1) = 5 : myData(3, 2) = "unentschieden"
        myData(4, 1) = 7 : myData(4, 2) = "Stimme zu"
        myData(5, 1) = 9 : myData(5, 2) = "Stimme voll und ganz zu"
        ' Durchsucht das Datenarray nach
        Dim result as String
        result = MyVlook(4, myData, 2, 1)
        ' Zeigt die Meldung "Stimme nicht zu"
        MsgBox result
    End Sub
  Verwenden Sie die Formeltextzeichenfolge, um einer Tabellenzelle eine Formel hinzuzufügen.
Alle Calc-Funktionen müssen mit ihren englischen Namen ausgedrückt werden.
Sub AssignFormulaToCell
REM Fügt Zelle A1 eine Formel hinzu. Der Funktionsname muss auf Englisch sein.
    oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A1")
    oCell.Formula = "=SUM(B1:B10)"
REM Zelle A1 zeigt den lokalisierten Funktionsnamen an
End Sub
Die Add-In-Funktionen von Calc befinden sich in den UNO-Diensten com.sun.star.sheet.addin.Analysis, com.sun.star.sheet.addin.DateFunctions und com.sun.star.sheet.addin.PricingFunctions.
REM Beispiel für den Aufruf der Add-In-Funktion WURZELPI
Function MeineWURZELPI(arg as double) as double
   Dim oService as Object
   oService = CreateUnoService("com.sun.star.sheet.addin.Analysis")
   MeineWURZELPI = oService.getSqrtPi(arg)
End Function
Die Add-In-Funktion muss durch ihren UNO-Dienstnamen ausgedrückt werden.
Sub AssignAddInFormulaToCell
REM Fügt Zelle A1 eine Add-In-Formel hinzu. Funktionsname ist der UNO-Dienstname.
    oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A1")
    oCell.Formula = "=com.sun.star.sheet.addin.Analysis.getBin2Dec(B1)"
REM Zelle A1 zeigt den lokalisierten Funktionsnamen an
End Sub
Die folgende Tabelle zeigt eine Liste aller Add-In-Funktionen für Analysis von Calc und ihrer jeweiligen UNO-Dienstnamen.
| Funktionsname in Calc | Name des UNO-Diensts | 
|---|---|
| AUFGELZINS | com.sun.star.sheet.addin.Analysis.getAccrint | 
| AUFGELZINSF | com.sun.star.sheet.addin.Analysis.getAccrintm | 
| AMORDEGRK | com.sun.star.sheet.addin.Analysis.getAmordegrc | 
| AMORLINEARK | com.sun.star.sheet.addin.Analysis.getAmorlinc | 
| BESSELI | com.sun.star.sheet.addin.Analysis.getBesseli | 
| BESSELJ | com.sun.star.sheet.addin.Analysis.getBesselj | 
| BESSELK | com.sun.star.sheet.addin.Analysis.getBesselk | 
| BESSELY | com.sun.star.sheet.addin.Analysis.getBessely | 
| BININDEZ | com.sun.star.sheet.addin.Analysis.getBin2Dec | 
| BININHEX | com.sun.star.sheet.addin.Analysis.getBin2Hex | 
| BININOKT | com.sun.star.sheet.addin.Analysis.getBin2Oct | 
| KOMPLEXE | com.sun.star.sheet.addin.Analysis.getComplex | 
| UMRECHNEN | com.sun.star.sheet.addin.Analysis.getConvert | 
| ZINSTERMTAGVA | com.sun.star.sheet.addin.Analysis.getCoupdaybs | 
| ZINSTERMTAGE | com.sun.star.sheet.addin.Analysis.getCoupdays | 
| ZINSTERMTAGNZ | com.sun.star.sheet.addin.Analysis.getCoupdaysnc | 
| ZINSTERMNZ | com.sun.star.sheet.addin.Analysis.getCoupncd | 
| ZINSTERMZAHL | com.sun.star.sheet.addin.Analysis.getCoupnum | 
| ZINSTERMVZ | com.sun.star.sheet.addin.Analysis.getCouppcd | 
| KUMZINSZ | com.sun.star.sheet.addin.Analysis.getCumipmt | 
| KUMKAPITAL | com.sun.star.sheet.addin.Analysis.getCumprinc | 
| DEZINBIN | com.sun.star.sheet.addin.Analysis.getDec2Bin | 
| DEZINHEX | com.sun.star.sheet.addin.Analysis.getDec2Hex | 
| DEZINOKT | com.sun.star.sheet.addin.Analysis.getDec2Oct | 
| DELTA | com.sun.star.sheet.addin.Analysis.getDelta | 
| DISAGIO | com.sun.star.sheet.addin.Analysis.getDisc | 
| NOTIERUNGDEZ | com.sun.star.sheet.addin.Analysis.getDollarde | 
| NOTIERUNGBRU | com.sun.star.sheet.addin.Analysis.getDollarfr | 
| LAUFZEIT | com.sun.star.sheet.addin.Analysis.getDuration | 
| EDATUM | com.sun.star.sheet.addin.Analysis.getEdate | 
| EFFEKTIV | com.sun.star.sheet.addin.Analysis.getEffect | 
| MONATSENDE | com.sun.star.sheet.addin.Analysis.getEomonth | 
| GAUSSFEHLER | com.sun.star.sheet.addin.Analysis.getErf | 
| GAUSSFKOMPL | com.sun.star.sheet.addin.Analysis.getErfc | 
| ZWEIFAKULTÄT | com.sun.star.sheet.addin.Analysis.getFactdouble | 
| ZW2 | com.sun.star.sheet.addin.Analysis.getFvschedule | 
| GGT | com.sun.star.sheet.addin.Analysis.getGcd | 
| GGANZZAHL | com.sun.star.sheet.addin.Analysis.getGestep | 
| HEXINBIN | com.sun.star.sheet.addin.Analysis.getHex2Bin | 
| HEXINDEZ | com.sun.star.sheet.addin.Analysis.getHex2Dec | 
| HEXINOKT | com.sun.star.sheet.addin.Analysis.getHex2Oct | 
| IMABS | com.sun.star.sheet.addin.Analysis.getImabs | 
| IMAGINÄRTEIL | com.sun.star.sheet.addin.Analysis.getImaginary | 
| IMARGUMENT | com.sun.star.sheet.addin.Analysis.getImargument | 
| IMKONJUGIERT | com.sun.star.sheet.addin.Analysis.getImconjugate | 
| IMCOS | com.sun.star.sheet.addin.Analysis.getImcos | 
| IMCOSHYP | com.sun.star.sheet.addin.Analysis.getImcosh | 
| IMCOT | com.sun.star.sheet.addin.Analysis.getImcot | 
| IMCOSEC | com.sun.star.sheet.addin.Analysis.getImcsc | 
| IMCOSECHYP | com.sun.star.sheet.addin.Analysis.getImcsch | 
| IMDIV | com.sun.star.sheet.addin.Analysis.getImdiv | 
| IMEXP | com.sun.star.sheet.addin.Analysis.getImexp | 
| IMLN | com.sun.star.sheet.addin.Analysis.getImln | 
| IMLOG10 | com.sun.star.sheet.addin.Analysis.getImlog10 | 
| IMLOG2 | com.sun.star.sheet.addin.Analysis.getImlog2 | 
| IMPOTENZ | com.sun.star.sheet.addin.Analysis.getImpower | 
| IMPRODUKT | com.sun.star.sheet.addin.Analysis.getImproduct | 
| IMREALTEIL | com.sun.star.sheet.addin.Analysis.getImreal | 
| IMSEC | com.sun.star.sheet.addin.Analysis.getImsec | 
| IMSECHYP | com.sun.star.sheet.addin.Analysis.getImsech | 
| IMSIN | com.sun.star.sheet.addin.Analysis.getImsin | 
| IMSINHYP | com.sun.star.sheet.addin.Analysis.getImsinh | 
| IMWURZEL | com.sun.star.sheet.addin.Analysis.getImsqrt | 
| IMSUB | com.sun.star.sheet.addin.Analysis.getImsub | 
| IMSUMME | com.sun.star.sheet.addin.Analysis.getImsum | 
| IMTAN | com.sun.star.sheet.addin.Analysis.getImtan | 
| ZINSSATZ | com.sun.star.sheet.addin.Analysis.getIntrate | 
| ISTGERADE | com.sun.star.sheet.addin.Analysis.getIseven | 
| ISTUNGERADE | com.sun.star.sheet.addin.Analysis.getIsodd | 
| KGV | com.sun.star.sheet.addin.Analysis.getLcm | 
| MLAUFZEIT | com.sun.star.sheet.addin.Analysis.getMduration | 
| VRUNDEN | com.sun.star.sheet.addin.Analysis.getMround | 
| POLYNOMIAL | com.sun.star.sheet.addin.Analysis.getMultinomial | 
| NETTOARBEITSTAGE | com.sun.star.sheet.addin.Analysis.getNetworkdays | 
| NOMINAL | com.sun.star.sheet.addin.Analysis.getNominal | 
| OKTINBIN | com.sun.star.sheet.addin.Analysis.getOct2Bin | 
| OKTINDEZ | com.sun.star.sheet.addin.Analysis.getOct2Dec | 
| OKTINHEX | com.sun.star.sheet.addin.Analysis.getOct2Hex | 
| UNREGERKURS | com.sun.star.sheet.addin.Analysis.getOddfprice | 
| UNREGERREND | com.sun.star.sheet.addin.Analysis.getOddfyield | 
| UNREGLEKURS | com.sun.star.sheet.addin.Analysis.getOddlprice | 
| UNREGLEREND | com.sun.star.sheet.addin.Analysis.getOddlyield | 
| KURS | com.sun.star.sheet.addin.Analysis.getPrice | 
| KURSDISAGIO | com.sun.star.sheet.addin.Analysis.getPricedisc | 
| KURSFÄLLIG | com.sun.star.sheet.addin.Analysis.getPricemat | 
| QUOTIENT | com.sun.star.sheet.addin.Analysis.getQuotient | 
| ZUFALLSBEREICH | com.sun.star.sheet.addin.Analysis.getRandbetween | 
| AUSZAHLUNG | com.sun.star.sheet.addin.Analysis.getReceived | 
| POTENZREIHE | com.sun.star.sheet.addin.Analysis.getSeriessum | 
| WURZELPI | com.sun.star.sheet.addin.Analysis.getSqrtpi | 
| TBILLÄQUIV | com.sun.star.sheet.addin.Analysis.getTbilleq | 
| TBILLKURS | com.sun.star.sheet.addin.Analysis.getTbillprice | 
| TBILLRENDITE | com.sun.star.sheet.addin.Analysis.getTbillyield | 
| KALENDERWOCHE | com.sun.star.sheet.addin.Analysis.getWeeknum | 
| ARBEITSTAG | com.sun.star.sheet.addin.Analysis.getWorkday | 
| XINTZINSFUSS | com.sun.star.sheet.addin.Analysis.getXirr | 
| XKAPITALWERT | com.sun.star.sheet.addin.Analysis.getXnpv | 
| BRTEILJAHRE | com.sun.star.sheet.addin.Analysis.getYearfrac | 
| RENDITE | com.sun.star.sheet.addin.Analysis.getYield | 
| RENDITEDIS | com.sun.star.sheet.addin.Analysis.getYielddisc | 
| RENDITEFÄLL | com.sun.star.sheet.addin.Analysis.getYieldmat | 
Die folgende Tabelle zeigt eine Liste aller Add-In-Funktionen für Daten von Calc und ihrer jeweiligen UNO-Dienstnamen.
| Funktionsname in Calc | Name des UNO-Diensts | 
|---|---|
| TAGEIMMONAT | com.sun.star.sheet.addin.DateFunctions.getDaysInMonth | 
| TAGEIMJAHR | com.sun.star.sheet.addin.DateFunctions.getDaysInMonth | 
| MONATE | com.sun.star.sheet.addin.DateFunctions.getDiffMonths | 
| WOCHEN | com.sun.star.sheet.addin.DateFunctions.getDiffWeeks | 
| JAHRE | com.sun.star.sheet.addin.DateFunctions.getDiffYears | 
| ROT13 | com.sun.star.sheet.addin.DateFunctions.getRot13 | 
| WOCHENIMJAHR | com.sun.star.sheet.addin.DateFunctions.getWeeksInYear | 
Die folgende Tabelle zeigt eine Liste aller Add-In-Funktionen für Preisgestaltung von Calc und ihrer jeweiligen UNO-Dienstnamen.
| Funktionsname in Calc | Name des UNO-Diensts | 
|---|---|
| OPT_BARRIER | com.sun.star.sheet.addin.PrincingFunctions.getOptBarrier | 
| OPT_PROB_HIT | com.sun.star.sheet.addin.PrincingFunctions.getOptProbHit | 
| OPT_PROB_INMONEY | com.sun.star.sheet.addin.PrincingFunctions.getOptProbInMoney | 
| OPT_TOUCH | com.sun.star.sheet.addin.PrincingFunctions.getOptTouch |