protected override RadExpression EvaluateOverride(FunctionEvaluationContext <object> context) { string reference = context.Arguments[0].ToString(); if (string.IsNullOrEmpty(reference)) { return(ErrorExpressions.ReferenceError); } List <CellReferenceRange> cellReferenceRanges = new List <CellReferenceRange>(); CellReferenceRangeExpression expression; if (NameConverter.TryConvertNamesToCellReferenceRangeExpression(reference, context.Worksheet, context.RowIndex, context.ColumnIndex, out expression)) { cellReferenceRanges.AddRange(expression.CellReferenceRanges); } if (cellReferenceRanges.Count == 1) { CellReferenceRange cellReferenceRange = cellReferenceRanges.First(); if (cellReferenceRange.Worksheet == context.Worksheet) { CellRange cellRange = cellReferenceRange.ToCellRange(); if (cellRange.Contains(context.RowIndex, context.ColumnIndex)) { return(ErrorExpressions.CyclicReference); } } } if (cellReferenceRanges.Count == 0) { return(ErrorExpressions.ReferenceError); } return(expression); }