uRWxR‖

EMbBZ‖Add-in Functions

Qq6yz‖The following describes and lists some of the available add-in functions.

DbbqV‖Add-in concept

YD6wG‖You will also find a description of the LibreOfficeDev Calc add-in interface in the Help. In addition, important functions and their parameters are described in the Help for the .

FqTdJ‖Add-ins supplied

5R8nv‖LibreOfficeDev contains examples for the add-in interface of LibreOfficeDev Calc.

H5JWB‖Analysis Functions Part One

mbKx7‖Analysis Functions Part Two

MaQes‖

7HPAm‖YEARS

LoBLi‖Calculates the difference in years between two dates.

GSbiK‖Syntax

MsnLa‖YEARS(StartDate; EndDate; Type)

i8TLM‖StartDate is the first date

pwhzA‖EndDate is the second date

eBu53‖Type calculates the type of difference. Possible values are 0 (interval) and 1 (in calendar years).

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.YEARS

tip

c7nbU‖

9opGk‖DAYSINMONTH

M8J3o‖Calculates the number of days of the month in which the date entered occurs.

GSbiK‖Syntax

pBMn5‖DAYSINMONTH(Date)

bgX8N‖Date is any date in the respective month of the desired year. The Date parameter must be a valid date according to the locale settings of LibreOfficeDev.

MiUAf‖Example

HUx2W‖=DAYSINMONTH(A1) returns 29 days if A1 contains 1968-02-17, a valid date for February 1968.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.DAYSINMONTH

tip

ZcGub‖

EN78e‖ISLEAPYEAR

FAqAb‖Determines whether a year is a leap year. If yes, the function will return the value 1 (TRUE); if not, it will return 0 (FALSE).

GSbiK‖Syntax

XbTHQ‖ISLEAPYEAR(Date)

orhWt‖Date specifies whether a given date falls within a leap year. The Date parameter must be a valid date.

warning

6LMA9‖Microsoft Excel wrongly assumes year 1900 to be a leap year and considers the inexistent day of 1900-02-29 as valid in date calculations. Dates prior to 1900-03-01 are therefore different in Excel and Calc.


MiUAf‖Example

ZJXKa‖=ISLEAPYEAR(A1) returns 1, if A1 contains 1968-02-29, the valid date 29th of February 1968 in your locale setting.

iLqDE‖You may also use =ISLEAPYEAR(DATE(1968;2;29)) or =ISLEAPYEAR("1968-02-29") giving the date string in the ISO 8601 notation.

EDqrB‖Never use =ISLEAPYEAR(2/29/68), because this would first evaluate 2 divided by 29 divided by 68, and then calculate the ISLEAPYEAR function from this small number as a serial date number.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.ISLEAPYEAR

tip

3wsG2‖

UxPtk‖MONTHS

q2Jcr‖Calculates the difference in months between two dates.

GSbiK‖Syntax

hQGKL‖MONTHS(StartDate; EndDate; Type)

5JEZA‖StartDate is the first date

C3sDr‖EndDate is the second date

5HCGD‖Type calculates the type of difference. Possible values include 0 (interval) and 1 (in calendar months).

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.MONTHS

tip

rEsia‖

eBNxc‖ROT13

MPeWE‖Encrypts a character string by moving the characters 13 positions in the alphabet. After the letter Z, the alphabet begins again (Rotation). By applying the encryption function again to the resulting code, you can decrypt the text.

GSbiK‖Syntax

bCDPT‖ROT13(Text)

5gMJ8‖Text is the character string to be encrypted. ROT13(ROT13(Text)) decrypts the code.

MiUAf‖Example

tN74B‖=ROT13("Gur Qbphzrag Sbhaqngvba jnf sbhaqrq va Frcgrzore 2010.") returns the string "The Document Foundation was founded in September 2010.". Notice how spaces, digits, and full stops are unaffected by ROT13.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.ROT13

tip

Hzbcx‖Refer to the ROT13 wiki page for more details about this function.


CFJsA‖

hWZ9d‖DAYSINYEAR

cyjpz‖Calculates the number of days of the year in which the date entered occurs.

GSbiK‖Syntax

STiAZ‖DAYSINYEAR(Date)

68qrS‖Date is any date in the respective year. The Date parameter must be a valid date according to the locale settings of LibreOfficeDev.

MiUAf‖Example

4j6rB‖=DAYSINYEAR(A1) returns 366 days if A1 contains 1968-02-29, a valid date for the year 1968.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.DAYSINYEAR

tip

iJAzE‖

kVGxj‖WEEKS

W7FhE‖Calculates the difference in weeks between two dates.

GSbiK‖Syntax

3N4Ca‖WEEKS(StartDate; EndDate; Type)

uwhoB‖StartDate is the start date in the interval.

AGYKD‖EndDate is the end date in the interval. The end date must be greater than the start date, or else an error is returned.

PcBbC‖Type specifies the type of difference to be calculated. Possible values are 0 (time interval) or 1 (calendar weeks).

QaW6B‖If Type = 0 the function will assume that 7 days is equivalent to one week without considering any specific day to mark the beginning of a week.

geCV7‖If Type = 1 the function will consider Monday to be the first day of the week. Therefore, except for the start date, each occurrence of a Monday in the interval is counted as an additional week.

note

CF4K3‖This function considers Monday to be the first day of the week regardless of the current locale settings.


MiUAf‖Example

H2Gpc‖In the following examples, dates are passed as strings. However, they can also be stored in separate cells and be passed as references.

EVSE2‖=WEEKS("2022-01-12","2022-01-17",0) returns 0 because Type was set to 0 and there are only 5 days in the interval.

pEEeF‖=WEEKS("2022-01-12","2022-01-19",0) returns 1 because Type was set to 0 and there are 7 days in the interval.

9DhQj‖=WEEKS("2022-01-12","2022-01-17",1) returns 1 because Type was set to 1 and the interval contains a Monday, since 2022-01-12 is a Wednesday and 2022-01-17 is a Monday.

E89BB‖=WEEKS("2022-01-12","2022-01-15",1) returns 0 because Type was set to 1 and the interval does not contain any Mondays, except for the start date.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.WEEKS

tip

94JhK‖

pomkP‖WEEKSINYEAR

Xs58F‖Calculates the number of weeks of the year in which the date entered occurs. The number of weeks is defined as follows: a week that spans two years is added to the year in which most days of that week occur.

GSbiK‖Syntax

84kGK‖WEEKSINYEAR(Date)

wB2Qe‖Date is any date in the respective year. The Date parameter must be a valid date according to the locale settings of LibreOfficeDev.

note

HCG9B‖Following ISO 8601, this function considers Monday to be the first day of the week, and the first week of a year is the one with most days in this year.


MiUAf‖Example

bPF33‖WEEKSINYEAR(A1) returns 53 if A1 contains 1970-02-17, a valid date for the year 1970.

XAFa7‖Technical information

2C7vt‖This function is NOT part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.WEEKSINYEAR

tip

ArNDo‖Add-ins through LibreOfficeDev API

RzAEH‖Add-ins can also be implemented through the LibreOfficeDev API.