Spread WPF 18
Features / Formulas and Functions / Nested Functions
In This Topic
    Nested Functions
    In This Topic

    Nested functions refer to a situation where one function is placed inside another function. This allows you to perform more complex calculations by combining multiple functions in a single formula. The output of one function becomes the input for another. To create a nested function in the worksheet, you can use the Formula property of the IRange interface, just as you would with a regular formula.

    The following image illustrates how to nest the AVERAGE and SUM functions in an IF function.

     

    Refer to the following example code to nest the AVERAGE and SUM functions in an IF function.

    Copy Code
    // Nested function.
    spreadSheet1.Workbook.ActiveSheet.Cells["E2"].Formula = "=IF(AVERAGE(B1:B4)>50,SUM(A1:A4),0)";
    
    Copy Code
    ' Nested function.
    spreadSheet1.Workbook.ActiveSheet.Cells("E2").Formula = "=IF(AVERAGE(B1:B4)>50,SUM(A1:A4),0)"