Spread.NET 18 Formula Reference
Formula Functions / Functions D to G / EVALUATE
In This Topic
    EVALUATE
    In This Topic

    This function is used to evaluate a text equation as an algebraic equation.

    Syntax

    =EVALUATE(formula)

    Arguments

    This function has the following argument:

    Argument

    Description

    formula

     Refers to a string that represents a formula or expression to be evaluated. This formula can reference cells or ranges in the worksheet.

    Remarks

    This function cannot be used directly in a cell, like SUM or AVERAGE functions. It must be used in the formula expressions applied to a custom-named range only. Therefore, if you use this function as "=EVALUATE(A1)", it throws an error. However, if you use the EVALUATE function as a custom name and then call the name from the target cell as "=EVALUATE("=A1+A2")", it returns the evaluated result of the cell range.

    Data Types

    Returns the evaluated results.

    Example

    The following example code uses the "EVALUATE(A1:A2)" function to create the named range "test," which evaluates the expressions present in cells "B1" and "B2" and displays the evaluated result in cell "C1".

     // Adding EVALUATE Function
     IWorksheet TestActiveSheet = fpSpread1.AsWorkbook().ActiveSheet;
     fpSpread1.AsWorkbook().Names.Add("test", "EVALUATE(A1:A2)", null, 0, 1);
     TestActiveSheet.Cells["B1"].Value = "1+1";
     TestActiveSheet.Cells["B2"].Value = "2+3";
     TestActiveSheet.Cells["C1"].Formula2 = "test";
     fpSpread1.SaveExcel("Book_EvaluateFunction.xlsm", ExcelSaveFlags.MacroEnabledWorkbook);
    
    The EVALUATE function requires VBA macros to be enabled to calculate as it is implemented as a (built-in) VBA extension function. A workbook that has the EVALUATE function applied must be saved in Excel Macro-Enabled Workbook (.XLSM) format. Using the MacroEnabledWorkbook member of the ExcelSaveFlags enumeration, you can save the workbook to .XLSM format.

    Version Available

    This function is available in product version 17.0 or later.