module

Sheety::Functions

Constants

DEFAULT_PRECISION = 64

Default precision for BigFloat operations (enough for most Excel use cases)

Class methods

abs(value : CellValue) : CellValue

ABS: Returns the absolute value of a number

Source
and(values : Array(CellValue)) : CellValue

AND: Returns TRUE if all arguments are TRUE

Source
average(values : Array(CellValue)) : CellValue

AVERAGE: Single array overload for backward compatibility

Source
average(*values : CellValue | Array(CellValue)) : CellValue

AVERAGE: Multiple arguments (arrays and/or scalars mixed)

Source
average(*values : Array(CellValue)) : CellValue

AVERAGE: Multiple arrays only

Source
ceiling(number : CellValue, significance : CellValue = 1.0) : CellValue

CEILING: Rounds number up to nearest multiple of significance

Source
clean(text : CellValue) : CellValue

CLEAN: Removes non-printable characters

Source
concat(values : Array(CellValue)) : CellValue

CONCAT: Single array overload for backward compatibility

Source
concat(*values : Array(CellValue)) : CellValue

CONCAT: Joins several text strings into one text string (supports multiple arrays)

Source
count(values : Array(CellValue)) : CellValue

COUNT: Single array overload for backward compatibility

Source
count(*values : CellValue | Array(CellValue)) : CellValue

COUNT: Multiple arguments (arrays and/or scalars mixed)

Source
count(*values : Array(CellValue)) : CellValue

COUNT: Multiple arrays only

Source
counta(values : Array(CellValue)) : CellValue

COUNTA: Counts how many values are in the list of arguments (non-empty)

Source
countif(range : Array(CellValue), criteria : CellValue) : CellValue

COUNTIF: Counts cells meeting condition

Source
datedif(start_date : CellValue, end_date : CellValue, unit : CellValue) : CellValue

DATEDIF: Calculates difference between two dates

Source
day(serial_number : CellValue) : CellValue

DAY: Extracts day from date serial number

Source
div0

Create common Excel errors

Source
eomonth(start_date : CellValue, months : CellValue = 0.0) : CellValue

EOMONTH: Returns last day of month offset from date

Source
eq(left : CellValue, right : CellValue) : CellValue

Equality test

Source
exact(text1 : CellValue, text2 : CellValue) : CellValue

EXACT: Compares two text strings (case-sensitive)

Source
find(find_text : CellValue, within_text : CellValue, start_num : CellValue = 1.0) : CellValue

FIND: Returns starting position of one text string within another (case-sensitive)

Source
flatten

Zero-argument overload so degenerate formulas like =AND() still compile.

Source
flatten(*values : CellValue | Array(CellValue)) : Array(CellValue)

Flatten mixed arguments into a single array of cell values: scalars are appended, arrays are concatenated. Used by the code generator for functions that conceptually take a flat list of values but may receive any mix of cell references and ranges (AND, OR, CONCAT, IFS, MEDIAN, STDEV, ...). Mirrors the argument handling of the sum overloads.

Source
floor(number : CellValue, significance : CellValue = 1.0) : CellValue

FLOOR: Rounds number down to nearest multiple of significance

Source
ge(left : CellValue, right : CellValue) : CellValue

Greater than or equal

Source
gt(left : CellValue, right : CellValue) : CellValue

Greater than

Source
hlookup(lookup_value : CellValue, table_array : Array(Array(CellValue)), row_index_num : CellValue, range_lookup : CellValue | Nil = true) : CellValue

HLOOKUP: Horizontal lookup

Source
if(condition : CellValue, true_value : CellValue, false_value : CellValue) : CellValue

IF: Specifies a logical test to perform

Source
ifs(pairs : Array(CellValue)) : CellValue

IFS: Evaluates multiple conditions and returns value for first true condition

Source
index_func(array : Array(Array(CellValue)), row_num : CellValue, column_num : CellValue = 1.0) : CellValue

INDEX: Returns value from array at given position

Source
int(value : CellValue) : CellValue

INT: Rounds a number down to the nearest integer

Source
le(left : CellValue, right : CellValue) : CellValue

Less than or equal

Source
left(text : CellValue, num_chars : CellValue = 1.0) : CellValue

LEFT: Returns the specified number of characters from the start of a text string

Source
len(text : CellValue) : CellValue

LEN: Returns the number of characters in a text string

Source
lower(text : CellValue) : CellValue

LOWER: Converts text to lowercase

Source
lt(left : CellValue, right : CellValue) : CellValue

Less than

Source
max(values : Array(CellValue)) : CellValue

MAX: Single array overload for backward compatibility

Source
max(*values : CellValue | Array(CellValue)) : CellValue

MAX: Multiple arguments (arrays and/or scalars mixed)

Source
max(*values : Array(CellValue)) : CellValue

MAX: Multiple arrays only

Source
median(values : Array(CellValue)) : CellValue

MEDIAN: Returns the median of the given numbers

Source
mid(text : CellValue, start_num : CellValue, num_chars : CellValue) : CellValue

MID: Returns a specific number of characters from a text string starting at a specified position

Source
min(values : Array(CellValue)) : CellValue

MIN: Single array overload for backward compatibility

Source
min(*values : CellValue | Array(CellValue)) : CellValue

MIN: Multiple arguments (arrays and/or scalars mixed)

Source
min(*values : Array(CellValue)) : CellValue

MIN: Multiple arrays only

Source
mod(number : CellValue, divisor : CellValue) : CellValue

MOD: Returns the remainder after division

Source
month(serial_number : CellValue) : CellValue

MONTH: Extracts month from date serial number

Source
name
Source
ne(left : CellValue, right : CellValue) : CellValue

Inequality test

Source
not(value : CellValue) : CellValue

NOT: Reverses the logic of its argument

Source
now

NOW: Returns current date and time as serial number

Source
or(values : Array(CellValue)) : CellValue

OR: Returns TRUE if any argument is TRUE

Source
power(base : CellValue, exponent : CellValue) : CellValue

POWER: Returns the result of a number raised to a power

Source
proper(text : CellValue) : CellValue

PROPER: Capitalizes first letter of each word

Source
rand

RAND: Returns a random number between 0 and 1

Source
randbetween(bottom : CellValue, top : CellValue) : CellValue

RANDBETWEEN: Returns random integer between two numbers

Source
rept(text : CellValue, number_times : CellValue) : CellValue

REPT: Repeats text given number of times

Source
right(text : CellValue, num_chars : CellValue = 1.0) : CellValue

RIGHT: Returns the specified number of characters from the end of a text string

Source
round(value : CellValue, digits : CellValue = 0.0) : CellValue

ROUND: Rounds a number to a specified number of digits

Source
rounddown(number : CellValue, digits : CellValue = 0.0) : CellValue

ROUNDDOWN: Rounds number down toward zero

Source
roundup(number : CellValue, digits : CellValue = 0.0) : CellValue

ROUNDUP: Rounds number up away from zero

Source
search(find_text : CellValue, within_text : CellValue, start_num : CellValue = 1.0) : CellValue

SEARCH: Returns position of one text string within another (case-insensitive)

Source
sqrt(value : CellValue) : CellValue

SQRT: Returns the square root of a number

Source
stdev(values : Array(CellValue)) : CellValue

STDEV.S: Estimates standard deviation based on a sample

Source
stdev_p(values : Array(CellValue)) : CellValue

STDEV.P: Calculates standard deviation based on entire population

Source
substitute(text : CellValue, old_text : CellValue, new_text : CellValue, instance_num : CellValue | Nil = nil) : CellValue

SUBSTITUTE: Replaces existing text with new text

Source
sum(values : Array(CellValue)) : CellValue

SUM: Single array overload for backward compatibility

Source
sum(*values : CellValue | Array(CellValue)) : CellValue

SUM: Multiple arguments (arrays and/or scalars mixed)

Source
sum(*values : Array(CellValue)) : CellValue

SUM: Multiple arrays only

Source
sumif(range : Array(CellValue), criteria : CellValue, sum_range : Array(CellValue) | Nil = nil) : CellValue

SUMIF: Sums cells meeting condition

Source
switch_func(expression : CellValue, pairs : Array(CellValue), default : CellValue | Nil = nil) : CellValue

SWITCH: Evaluates value against list and returns matching result

Source
text_func(value : CellValue, format_text : CellValue) : CellValue

TEXT: Formats a number and converts to text

Source
to_float(value : CellValue) : BigFloat | Nil

Helper to convert cell value to BigFloat

Source
to_string(value : CellValue) : String

Helper to convert cell value to string

Source
today

TODAY: Returns current date as serial number

Source
trim(text : CellValue) : CellValue

TRIM: Removes spaces from text except for single spaces between words

Source
upper(text : CellValue) : CellValue

UPPER: Converts text to uppercase

Source
utc_days_in_month(year : Int32, month : Int32) : Int32
Source
value
Source
value_func(text : CellValue) : CellValue

VALUE: Converts text to number

Source
var_p(values : Array(CellValue)) : CellValue

VAR.P: Calculates variance based on entire population

Source
var_s(values : Array(CellValue)) : CellValue

VAR.S: Estimates variance based on a sample

Source
vlookup(lookup_value : CellValue, table_array : Array(Array(CellValue)), col_index_num : CellValue, range_lookup : CellValue | Nil = true) : CellValue

VLOOKUP: Vertical lookup

Source
year(serial_number : CellValue) : CellValue

YEAR: Extracts year from date serial number

Source
zero

Excel's MIN/MAX of an empty set is 0, not an error.

Source

Nested types