LibreOffice 25.2 Hjælp
Udover de medfødte BASIC-funktioner kan du kalde Calc-funktioner i dine makroer og scripts og sætte Calc-funktioner i celleformler.
Use the CreateUnoService function to access the com.sun.star.sheet.FunctionAccess service.
Eksemplet herunder opretter en funktion ved navn MyVlook, der kalder Calc-funktionen VLOOKUP (LOPSLAG) over en datamatrix, videregivet som argument og returnerer den værdi, funktionen har fundet.
    Function MyVlook(Lookup, DataArray As Object, Index As Integer, SortedRangeLookup as Byte)
        Dim oService As Object
        Set oService = CreateUnoService("com.sun.star.sheet.FunctionAccess")
        ' Brug altid engelske funktionsnavne
        MyVlook = oService.callFunction("VLOOKUP", Array(Lookup, DataArray, Index, SortedRangeLookup))
    End Function
  Makroen herunder præsenterer et eksempel på, hvordan funktionen MyVlook kan kaldes. Den opretter først en 5-gange-2 datamatrix og kalder derefter funktionen MyVlook og viser den returnerede værdi ved hjælp af MsgBox.
    Sub CallingMyVlook()
        ' Opretter en 5-gange-2-matrix og fylder den med data
        Dim myData(1 to 5, 1 to 2) as Variant
        myData(1, 1) = 1 : myData(1, 2) = "Er stærkt uenig"
        myData(2, 1) = 3 : myData(2, 2) = "Er uenig"
        myData(3, 1) = 5 : myData(3, 2) = "Uafklaret"
        myData(4, 1) = 7 : myData(4, 2) = "Er enig"
        myData(5, 1) = 9 : myData(5, 2) = "Er meget enig"
        ' Slår op i datamatrixen
        Dim result as String
        result = MyVlook(4, myData, 2, 1)
        ' Viser beskeden "Er uenig"
        MsgBox result
    End Sub
  Brug formlens tekststreng til at tilføje en formel til en regnearkscelle.
Alle Calc-funKtioner skal udtrykkes med deres engelske navne.
Sub AssignFormulaToCell
REM Tilføj en formel til celle A1. Funktionsnavne skal være på engelsk.
    oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A1")
    oCell.Formula = "=SUM(B1:B10)"
REM Celle A1 viser viser det lokaliserede funktionsnavn
End Sub
Tilføjelsesfunktionerne til Calc findes i UNO-tjenesterne com.sun.star.sheet.addin.Analysis, com.sun.star.sheet.addin.DateFunctions og com.sun.star.sheet.addin.PricingFunctions.
REM Eksempel, der kalder tilføjelsesfunktionen SQRTPI (kvrodpi)
Funktionen MySQRTPI(arg som dobbelt) som dobbelt
   Dim oService as Object
   oService = CreateUnoService("com.sun.star.sheet.addin.Analysis")
   MySQRTPI = oService.getSqrtPi(arg)
End Function
Tilføjelsesfunktionen skal udtrykkes med dens UNO-tjenestenavn
Sub AssignAddInFormulaToCell
REM Tilføj en tilføjelsesformel til celle A1. Funktionsnavn er UNO-tjenestens navn.
    oCell = ThisComponent.Sheets.getByIndex(0).getCellRangeByName("A1")
    oCell.Formula = "=com.sun.star.sheet.addin.Analysis.getBin2Dec(B1)"
REM Celle A1 viser det lokaliserede funktionsnavn
End Sub
Tabellen herunder præsenterer en liste over alle Analyse-tilføjelsesfunktioner til Calc og deres respektive UNO-tjenestenavne.
| Calc funktionsnavn | UNO-tjenestenavn | 
|---|---|
| PÅLØBRENTE | com.sun.star.sheet.addin.Analysis.getAccrint | 
| PÅLØBRENTE.UDLØB | com.sun.star.sheet.addin.Analysis.getAccrintm | 
| AMORDEGRC | com.sun.star.sheet.addin.Analysis.getAmordegrc | 
| AMORLINC | 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 | 
| BIN.TIL.DEC | com.sun.star.sheet.addin.Analysis.getBin2Dec | 
| BIN2HEX | com.sun.star.sheet.addin.Analysis.getBin2Hex | 
| BIN.TIL.OKT | com.sun.star.sheet.addin.Analysis.getBin2Oct | 
| COMPLEX | com.sun.star.sheet.addin.Analysis.getComplex | 
| CONVERT | com.sun.star.sheet.addin.Analysis.getConvert | 
| KUPONDAGE.SA | com.sun.star.sheet.addin.Analysis.getCoupdaybs | 
| KUPONDAGE.A | com.sun.star.sheet.addin.Analysis.getCoupdays | 
| KUPONDAGE.ANK | com.sun.star.sheet.addin.Analysis.getCoupdaysnc | 
| KUPONDAG.NÆSTE | com.sun.star.sheet.addin.Analysis.getCoupncd | 
| KUPONBETALINGER | com.sun.star.sheet.addin.Analysis.getCoupnum | 
| KUPONDAG.FORRIGE | com.sun.star.sheet.addin.Analysis.getCouppcd | 
| AKKUM.RENTE | com.sun.star.sheet.addin.Analysis.getCumipmt | 
| AKKUM.HOVEDSTOL | com.sun.star.sheet.addin.Analysis.getCumprinc | 
| DEC.TIL.BIN | com.sun.star.sheet.addin.Analysis.getDec2Bin | 
| DEC.TIL.HEX | com.sun.star.sheet.addin.Analysis.getDec2Hex | 
| DEC.TIL.OKT | com.sun.star.sheet.addin.Analysis.getDec2Oct | 
| DELTAB | com.sun.star.sheet.addin.Analysis.getDelta | 
| DISKONTO | com.sun.star.sheet.addin.Analysis.getDisc | 
| KR.DECIMAL | com.sun.star.sheet.addin.Analysis.getDollarde | 
| KR.BRØK | com.sun.star.sheet.addin.Analysis.getDollarfr | 
| VARIGHED | com.sun.star.sheet.addin.Analysis.getDuration | 
| EDATO | com.sun.star.sheet.addin.Analysis.getEdate | 
| EFFEKTIV.RENTE | com.sun.star.sheet.addin.Analysis.getEffect | 
| SLUT.PÅ.MÅNED | com.sun.star.sheet.addin.Analysis.getEomonth | 
| FEJLFUNK | com.sun.star.sheet.addin.Analysis.getErf | 
| FEJLFUNK.KOMP | com.sun.star.sheet.addin.Analysis.getErfc | 
| DOBBELT.FAKULTET | com.sun.star.sheet.addin.Analysis.getFactdouble | 
| FVTABEL | com.sun.star.sheet.addin.Analysis.getFvschedule | 
| STØRSTE.FÆLLES.DIVISOR | com.sun.star.sheet.addin.Analysis.getGcd | 
| GETRIN | com.sun.star.sheet.addin.Analysis.getGestep | 
| HEX.TIL.BIN | com.sun.star.sheet.addin.Analysis.getHex2Bin | 
| HEX.TIL.DEC | com.sun.star.sheet.addin.Analysis.getHex2Dec | 
| HEX.TIL.OKT | com.sun.star.sheet.addin.Analysis.getHex2Oct | 
| IMAGABS | com.sun.star.sheet.addin.Analysis.getImabs | 
| IMAGINÆRDEL | com.sun.star.sheet.addin.Analysis.getImaginary | 
| IMARGUMENT | com.sun.star.sheet.addin.Analysis.getImargument | 
| IMAGKONJUGERE | com.sun.star.sheet.addin.Analysis.getImconjugate | 
| IMAGCOS | com.sun.star.sheet.addin.Analysis.getImcos | 
| IMAGCOSH | com.sun.star.sheet.addin.Analysis.getImcosh | 
| IMAGCOT | com.sun.star.sheet.addin.Analysis.getImcot | 
| IMAGCSK | com.sun.star.sheet.addin.Analysis.getImcsc | 
| IMAGCSKH | com.sun.star.sheet.addin.Analysis.getImcsch | 
| IMAGDIV | com.sun.star.sheet.addin.Analysis.getImdiv | 
| IMAGEKSP | com.sun.star.sheet.addin.Analysis.getImexp | 
| IMAGLN | com.sun.star.sheet.addin.Analysis.getImln | 
| IMAGLOG10 | com.sun.star.sheet.addin.Analysis.getImlog10 | 
| IMAGLOG2 | com.sun.star.sheet.addin.Analysis.getImlog2 | 
| IMAGPOTENS | com.sun.star.sheet.addin.Analysis.getImpower | 
| IMAGPRODUKT | com.sun.star.sheet.addin.Analysis.getImproduct | 
| IMAGREELT | com.sun.star.sheet.addin.Analysis.getImreal | 
| IMAGSEK | com.sun.star.sheet.addin.Analysis.getImsec | 
| IMAGSEKN | com.sun.star.sheet.addin.Analysis.getImsech | 
| IMSIN | com.sun.star.sheet.addin.Analysis.getImsin | 
| IMAGSINH | com.sun.star.sheet.addin.Analysis.getImsinh | 
| IMAGKVROD | com.sun.star.sheet.addin.Analysis.getImsqrt | 
| IMAGSUB | com.sun.star.sheet.addin.Analysis.getImsub | 
| IMAGSUM | com.sun.star.sheet.addin.Analysis.getImsum | 
| IMAGTAN | com.sun.star.sheet.addin.Analysis.getImtan | 
| RENTEFOD | com.sun.star.sheet.addin.Analysis.getIntrate | 
| ER.LIGE | com.sun.star.sheet.addin.Analysis.getIseven | 
| ER.ULIGE | com.sun.star.sheet.addin.Analysis.getIsodd | 
| MINDSTE.FÆLLES.MULTIPLUM | com.sun.star.sheet.addin.Analysis.getLcm | 
| MVARIGHED | com.sun.star.sheet.addin.Analysis.getMduration | 
| MAFRUND | com.sun.star.sheet.addin.Analysis.getMround | 
| MULTINOMIAL | com.sun.star.sheet.addin.Analysis.getMultinomial | 
| ANTAL_ARBEJDSDAGE | com.sun.star.sheet.addin.Analysis.getNetworkdays | 
| NOMINEL | com.sun.star.sheet.addin.Analysis.getNominal | 
| OKT.TIL.BIN | com.sun.star.sheet.addin.Analysis.getOct2Bin | 
| OKT.TIL.DEC | com.sun.star.sheet.addin.Analysis.getOct2Dec | 
| OKT.TIL.HEX | com.sun.star.sheet.addin.Analysis.getOct2Hex | 
| ULIGE.KURS.PÅLYDENDE | com.sun.star.sheet.addin.Analysis.getOddfprice | 
| ULIGE.FØRSTE.AFKAST | com.sun.star.sheet.addin.Analysis.getOddfyield | 
| ULIGE.SIDSTE.KURS | com.sun.star.sheet.addin.Analysis.getOddlprice | 
| ULIGE.SIDSTE.AFKAST | com.sun.star.sheet.addin.Analysis.getOddlyield | 
| KURS | com.sun.star.sheet.addin.Analysis.getPrice | 
| KURS.DISKONTO | com.sun.star.sheet.addin.Analysis.getPricedisc | 
| KURS.UDLØB | com.sun.star.sheet.addin.Analysis.getPricemat | 
| KVOTIENT | com.sun.star.sheet.addin.Analysis.getQuotient | 
| SLUMPMELLEM | com.sun.star.sheet.addin.Analysis.getRandbetween | 
| MODTAGET.VED.UDLØB | com.sun.star.sheet.addin.Analysis.getReceived | 
| SERIESUM | com.sun.star.sheet.addin.Analysis.getSeriessum | 
| KVRODPI | com.sun.star.sheet.addin.Analysis.getSqrtpi | 
| TBILLEQ | com.sun.star.sheet.addin.Analysis.getTbilleq | 
| STATSOBLIGATION.KURS | com.sun.star.sheet.addin.Analysis.getTbillprice | 
| STATSOBLIGATION.AFKAST | com.sun.star.sheet.addin.Analysis.getTbillyield | 
| UGE.NR (på engelsk: WEEKNUM) | com.sun.star.sheet.addin.Analysis.getWeeknum | 
| ARBEJDSDAG | com.sun.star.sheet.addin.Analysis.getWorkday | 
| INTERN.RENTE | com.sun.star.sheet.addin.Analysis.getXirr | 
| NETTO.NUTIDSVÆRDI | com.sun.star.sheet.addin.Analysis.getXnpv | 
| ÅR.BRØK (på engelsk: YEARFRAC) | com.sun.star.sheet.addin.Analysis.getYearfrac | 
| AFKAST | com.sun.star.sheet.addin.Analysis.getYield | 
| AFKAST.DISKONTO | com.sun.star.sheet.addin.Analysis.getYielddisc | 
| AFKAST.UDLØBSDATO | com.sun.star.sheet.addin.Analysis.getYieldmat | 
Tabellen herunder præsenterer en liste over alle dato-tilføjelsesfunktioner til Calc og deres respektive UNO-tjenestenavne.
| Funktionsnavn i Calc | UNO-tjenestenavn | 
|---|---|
| DAGE.I.MÅNEDEN (på engelsk: DAYSINMONTH) | com.sun.star.sheet.addin.DateFunctions.getDaysInMonth | 
| DAGE.I.ÅRET (på engelsk: DAYSINYEAR) | com.sun.star.sheet.addin.DateFunctions.getDaysInMonth | 
| MONTHS | com.sun.star.sheet.addin.DateFunctions.getDiffMonths | 
| UGER (på engelsk: WEEKS) | com.sun.star.sheet.addin.DateFunctions.getDiffWeeks | 
| YEARS | com.sun.star.sheet.addin.DateFunctions.getDiffYears | 
| ROT13 | com.sun.star.sheet.addin.DateFunctions.getRot13 | 
| UGER.I.ÅRET (på engelsk: WEEKSINYEAR) | com.sun.star.sheet.addin.DateFunctions.getWeeksInYear | 
Tabellen herunder præsenterer en liste over alle Calc prissætnings-tilføjelsesfunktioner og deres respektive UNO-tjenestenavne.
| Funktionsnavn i Calc | UNO-tjenestenavn | 
|---|---|
| OPTION_GRÆNSE | com.sun.star.sheet.addin.PrincingFunctions.getOptBarrier | 
| OPTION_SANDSYNLIG_TRÆF | com.sun.star.sheet.addin.PrincingFunctions.getOptProbHit | 
| OPTION_SANDSYNLIG_IPENGE | com.sun.star.sheet.addin.PrincingFunctions.getOptProbInMoney | 
| OPTION_BERØR | com.sun.star.sheet.addin.PrincingFunctions.getOptTouch |