Supported Formula Functions

DroidXLS includes a built-in formula engine with ~30 functions. Unsupported formulas are preserved as-is and return #NAME?.

Usage

// Set a formula
sheet["C1"].formula = "=SUM(A1:B1)"

// Recalculate all formulas
val evaluator = FormulaEvaluator(sheet)
evaluator.recalculateAll()

Aggregate Functions

FunctionDescriptionExample
SUMSum of values=SUM(A1:A10)
AVERAGEArithmetic mean=AVERAGE(B1:B5)
COUNTCount numeric cells=COUNT(A:A)
COUNTACount non-empty cells=COUNTA(A1:A10)
COUNTBLANKCount empty cells=COUNTBLANK(A1:A10)
MAXMaximum value=MAX(A1:A10)
MINMinimum value=MIN(A1:A10)

Logic Functions

FunctionDescriptionExample
IFConditional=IF(A1>10,"big","small")
ANDLogical AND=AND(A1>0,B1>0)
ORLogical OR=OR(A1>0,B1>0)
NOTLogical NOT=NOT(A1)
IFERRORError handler=IFERROR(A1/B1,0)
IFNAHandle #N/A=IFNA(VLOOKUP(...),"")

Lookup Functions

FunctionDescriptionExample
VLOOKUPVertical lookup=VLOOKUP(A1,D:E,2,FALSE)
HLOOKUPHorizontal lookup=HLOOKUP(A1,1:2,2,FALSE)
INDEXValue at position=INDEX(A1:C3,2,3)
MATCHPosition of value=MATCH("x",A1:A10,0)

String Functions

FunctionDescriptionExample
CONCATENATEJoin strings=CONCATENATE(A1," ",B1)
LEFTLeft substring=LEFT(A1,3)
RIGHTRight substring=RIGHT(A1,3)
MIDMiddle substring=MID(A1,2,3)
LENString length=LEN(A1)
TRIMRemove extra spaces=TRIM(A1)
SUBSTITUTEReplace text=SUBSTITUTE(A1,"old","new")
UPPERTo uppercase=UPPER(A1)
LOWERTo lowercase=LOWER(A1)

Math Functions

FunctionDescriptionExample
ROUNDRound to digits=ROUND(3.14159,2)
ROUNDUPRound up=ROUNDUP(3.1,0)
ROUNDDOWNRound down=ROUNDDOWN(3.9,0)
ABSAbsolute value=ABS(-5)
MODModulo=MOD(10,3)
INTInteger part=INT(3.7)
CEILINGRound up to multiple=CEILING(2.3,1)
FLOORRound down to multiple=FLOOR(2.7,1)

Date Functions

FunctionDescriptionExample
TODAYCurrent date=TODAY()
NOWCurrent date and time=NOW()
DATECreate date=DATE(2025,3,25)
YEARExtract year=YEAR(A1)
MONTHExtract month=MONTH(A1)
DAYExtract day=DAY(A1)