SPREAD for WPF 3.0J - GcSpreadSheet
入れ子関数
SPREAD for WPF 3.0J - GcSpreadSheet > 開発者ガイド > 数式と関数 > 入れ子関数

GcSpreadSheetでは、通常の数式と同様にIRangeインタフェースのFormulaプロパティを使用してセル内に入れ子関数を作成できます。

次のサンプルコードは、IF関数内にAVERAGEおよびSUM関数を入れ子にする方法を示します。

コードのコピー
GcSpreadSheet.Workbook.ActiveSheet.Columns[4].ColumnWidth = 110;
GcSpreadSheet.Workbook.ActiveSheet.Cells[0, 0].Value = 23;
GcSpreadSheet.Workbook.ActiveSheet.Cells[1, 0].Value = 23;
GcSpreadSheet.Workbook.ActiveSheet.Cells[2, 0].Value = 23;
GcSpreadSheet.Workbook.ActiveSheet.Cells[3, 0].Value = 23;
GcSpreadSheet.Workbook.ActiveSheet.Cells[0, 1].Value = 123;
GcSpreadSheet.Workbook.ActiveSheet.Cells[1, 1].Value = 123;
GcSpreadSheet.Workbook.ActiveSheet.Cells[2, 1].Value = 123;
GcSpreadSheet.Workbook.ActiveSheet.Cells[3, 1].Value = 123;
GcSpreadSheet.Workbook.ActiveSheet.Cells["E1"].Text = "入れ子関数";
//入れ子関数
GcSpreadSheet.Workbook.ActiveSheet.Cells["E2"].Formula = "=IF(AVERAGE(B1:B4)>50,SUM(A1:A4),0)";
コードのコピー
GcSpreadSheet.Workbook.ActiveSheet.Columns(4).ColumnWidth = 110
GcSpreadSheet.Workbook.ActiveSheet.Cells(0, 0).Value = 23
GcSpreadSheet.Workbook.ActiveSheet.Cells(1, 0).Value = 23
GcSpreadSheet.Workbook.ActiveSheet.Cells(2, 0).Value = 23
GcSpreadSheet.Workbook.ActiveSheet.Cells(3, 0).Value = 23
GcSpreadSheet.Workbook.ActiveSheet.Cells(0, 1).Value = 123
GcSpreadSheet.Workbook.ActiveSheet.Cells(1, 1).Value = 123
GcSpreadSheet.Workbook.ActiveSheet.Cells(2, 1).Value = 123
GcSpreadSheet.Workbook.ActiveSheet.Cells(3, 1).Value = 123
GcSpreadSheet.Workbook.ActiveSheet.Cells("E1").Text = "入れ子関数"
'入れ子関数
GcSpreadSheet.Workbook.ActiveSheet.Cells("E2").Formula = "=IF(AVERAGE(B1:B4)>50,SUM(A1:A4),0)"