Table of Contents

TFormulaValue Record

Represents a value inside a formula. it might be an array of values in case it is an array formula.

Syntax

Unit: FlexCel.Core

TFormulaValue = record;

Methods

Name Description
Empty Creates a formula value without value.
Create Overloaded
Create(Double)
Create(Int64)
Create(TDateTime)
Create(string)
Create(Boolean)
Create(TFlxFormulaErrorValue)
Create(TFormulaValueArray2)
Create(TAddress)
Create(TSingleFormulaValue)
Create(TAverageValue)
Create(TArray<TAddress>, Boolean)
Create(Integer, Integer)
Create(TAddress, TAddress, Boolean)
MissingArg Creates a formula value containing a missing argument.
FromLambda Creates a formula value containing a Lambda. Note that Lambdas are used internally only.
You shouldn't use this overload, and a public TFormulaValue should never contain a lambda.
IsEmpty Returns true if the formula is empty.
HasValue Returns true if the formula has a value. This method is the same as not IsEmpty
IsNumber Returns true if the formula has a number.
IsDateTime Returns true if the formula has a datetime. Note that formulas by default never have datetimes, they have numbers instead.
IsString Returns true if the formula contains a string.
IsBoolean Returns true if the formula contains a boolean.
IsError Returns true if the formula contains an error.
IsArray Returns true if the formula contains an array of values instead of a single value.
IsMissingArg Returns true if the value is a missing argument from a function, like in the formula =MyFunction(1, ,3) where the second parameter is missing.
IsCellAddress Returns true if the formula has a TCellAddress
IsCellRange Returns true if the formula contains a range of cells.
IsRange3D Returns true if the formula contains a range of cells spanning more than one sheet.
IsAverage Returns true if the formula contains an Average value. This value is used internally to calculate averages, formula results won't contain averages.
IsLambda Returns true if the formula contains lambda function.
AsNumber Returns the value of the formula if it contains a number. If it contains other datatype, this method will throw an exception.



Check IsNumber to see if the formula contains a number.


AsDateTime Returns the value of the formula if it contains a detetime. If it contains other datatype, this method will throw an exception.



Check IsDateTime to see if the formula contains a datetime.


AsString Returns the value of the formula if it contains a string. If it contains other datatype, this method will throw an exception.



Check IsString to see if the formula contains a string.


AsBoolean Returns the value of the formula if it contains a boolean. If it contains other datatype, this method will throw an exception.



Check IsBoolean to see if the formula contains a boolean.


AsError Returns the value of the formula if it contains an error. If it contains other datatype, this method will throw an exception.



Check IsError to see if the formula contains an error.


AsCellAddress Returns the value of the formula if it contains a cell adress. If it contains other datatype, this method will throw an exception.



Check IsCellAddress to see if the formula contains a cell address.


AsCellRange Returns the value of the formula if it contains a range of cells.
If it contains other datatype, this method will throw an exception.



Check IsCellRange to see if the formula contains a range of cells.


AsRange3D Returns the value of the formula if it contains a range of cells covering many sheets. If it contains other datatype, this method will throw an exception.



Check IsRange3D to see if the formula contains a range of cells in multiple sheets.


AsAverage Returns the value of the formula if it contains an average. If it contains other datatype, this method will throw an exception.



Check IsAverage to see if the formula contains an average.


AsLambda Returns the value of the formula if it contains a a lambda. If it contains other datatype, this method will throw an exception.



Check IsLambda to see if the formula contains a lambda.


AsVariant Returns the formula result as a variant.
AsTValue Returns the formula result as a TValue.
ToString Converts the formula result to a string.
ToStringInvariant Converts the formula result to a string with invariant format. This means that for example the number 1.2 will be converted to the string '1.2' even if in the active locale it would '1,2' because the decimal separator is a comma. To get the number as a string in the current locale, use ToString
AsArray Returns the formula result as an array of values if the formula contains an array. If the formula result is not an array, this method will throw an exception.
TryAsArray Will return the formula result if the formula result is an array, or nil if the formula result is something else.
TryAsCellAddress Will return the formula result if the formula result is a cell address, or nil if the formula result is something else.
TryToDouble Tries to convert this value to a number, and returns true is possible.
GetLength Returns the length of any of the 2 possible dimensions of the array of TSingleFormulaValue

Operators

Properties

Name Description
ValueType Returns the type of value stored in the formula. (a string, a number etc). You can check for this directly or call the helper methods like IsNumber or IsBoolean. Those methods internally check for ValueType.