HotXLS-dokumentation Innehåll Startsida Översikt TGridToXLS IXLSWorkbook Startsida Innehåll Översikt

Calculate metod

Calculates the result of specified expression The worksheet evaluator shares the workbook formula engine and supports the same funktion groups: text functions (TRIM, PROPER, CLEAN, CHAR, CODE, T, EXACT, REPT, FIND, SEARCH, SUBSTITUTE, REPLACE); date functions (EDATE, EOMONTH, DATEDIF, YEARFRAC, DAYS, WEEKNUM, ISOWEEKNUM); workday functions (WORKDAY, NETWORKDAYS); engineering/base-conversion functions (DEC2BIN, DEC2HEX, DEC2OCT, BIN2DEC, BIN2HEX, BIN2OCT, OCT2DEC, OCT2BIN, OCT2HEX, HEX2DEC, HEX2BIN, HEX2OCT, BASE, DECIMAL, ARABIC); bitwise functions (BITAND, BITOR, BITXOR, BITLSHIFT, BITRSHIFT); statistical functions (VAR, VARP, STDEV, STDEVP, MODE, VARA, VARPA, STDEVA, STDEVPA); aggregate functions (PRODUCT, SUMSQ); math functions (GCD, LCM, MROUND, QUOTIENT, MULTINOMIAL) Custom or unsupported worksheet functions can still be resolved through OnUserFunction / OnUserFunctionEx

Syntax

function Calculate(Expression: WideString):Variant; Expression WideString. A string that specifies an expression which should be calculated

Exempel

This example calculates the sum of values in a range A1:A20
Val := Workbook.Sheets[1].Calculate('SUM(A1:A20)'); This example calculates a text expression in worksheet context
Val := Workbook.Sheets[1].Calculate('REPLACE("abcde";2;3;"XY")'); This example determines the smallest value in a range A1:F10 on Worksheet one
Val := Workbook.Sheets[1].Calculate('MIN(A1:F10)');

Se även

OnUserFunction callback
IXLSWorkbook.Calculatemetod Copyright © 2010-2026 losLab Software