xlwings Lite Add-in

Custom Functions

Custom Functions

The following custom functions are part of the introductory samples of xlwings Lite:

1. HELLO Function

Description

Returns a greeting message for the given name.

Syntax

=HELLO(name)

Arguments

ArgumentDescription
nameRequired. A text string representing the name to be included in the greeting.

Example

=HELLO("Alice")

Result: "Hello Alice!"


2. STANDARD_NORMAL Function

Description

Generates a matrix of standard normally distributed pseudo-random numbers and returns them in a structured DataFrame with dates as row indices.

Syntax

=STANDARD_NORMAL(rows, cols)

Arguments

ArgumentDescription
rowsRequired. The number of rows (dates) to generate.
colsRequired. The number of columns to generate.

Example

=STANDARD_NORMAL(5, 3)

Result: A 5-row by 3-column DataFrame containing random values with row indices as dates starting from June 15, 2025.


3. CORREL2 Function

Description

Computes the correlation matrix for an input DataFrame. Similar to Excel’s CORREL function but operates on matrices.

Syntax

=CORREL2(data)

Arguments

ArgumentDescription
dataRequired. A DataFrame containing numeric values for correlation calculation.

Example

=CORREL2(STANDARD_NORMAL(5, 3))

Result: A 3x3 correlation matrix showing the correlation coefficients between the columns of the generated DataFrame.