Skip to content

Commit c9c99a2

Browse files
committed
new KB
1 parent 7de6f71 commit c9c99a2

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

knowledge-base/sumproduct-function-nested-array-formulas-telerik-spreadprocessing.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type: how-to
55
page_title: SUMPRODUCT Function Implementation in Telerik SpreadProcessing
66
meta_title: SUMPRODUCT Function Implementation in Telerik SpreadProcessing
77
slug: sumproduct-function-nested-array-formulas-telerik-spreadprocessing
8-
tags: spreadprocessing, formula, custom function, sumproduct, array formulas
8+
tags: spread, processing, formula, custom, function, sumproduct, array
99
res_type: kb
1010
ticketid: 1694608
1111
---
@@ -18,11 +18,11 @@ ticketid: 1694608
1818

1919
## Description
2020

21-
Learn how to implement a custom SUMPRODUCT function that exists in Excel but not in Telerik SpreadProcessing. The function works for basic cases but returns incorrect results for formulas with nested array functions.
21+
Learn how to implement a custom [SUMPRODUCT](https://support.microsoft.com/en-us/office/sumproduct-function-16753e75-9f68-4874-94ac-4d2145a2fd2e) function in [RadSpreadProcessing]({%slug radspreadprocessing-overview%}).
2222

2323
## Solution
2424

25-
SpreadProcessing does not natively support full array formula evaluation or Excel-style boolean coercion inside custom functions. To achieve Excel-like results, manually evaluate nested logic before passing data to the custom function, or extend your implementation to handle nested expressions explicitly. Follow the steps below:
25+
Follow the steps:
2626

2727
1. Register your custom SUMPRODUCT function using the `FunctionManager.RegisterFunction()` method.
2828

@@ -87,8 +87,6 @@ SpreadProcessing does not natively support full array formula evaluation or Exce
8787
protected override RadExpression EvaluateOverride(FunctionEvaluationContext<object> context)
8888
{
8989
double result = 0;
90-
try
91-
{
9290
List<ArrayExpression> arrayExpressions = new List<ArrayExpression>();
9391
foreach (ArrayExpression array in context.Arguments)
9492
{
@@ -122,22 +120,13 @@ SpreadProcessing does not natively support full array formula evaluation or Exce
122120

123121
result = values.Sum();
124122
}
125-
}
126-
catch
127-
{
128-
// Do nothing
129-
}
130123

131124
return new NumberExpression(result);
132125
}
133126
}
134127
```
135128

136-
137-
Avoid using nested array formulas inside the spreadsheet. Instead, preprocess arrays in your code and provide numeric arrays as direct input to the custom function.
138-
139129
## See Also
140130

141-
- [Telerik Document Processing](https://docs.telerik.com/devtools/document-processing/introduction)
142-
- [SpreadProcessing: Implement the SUMPRODUCT Function](https://feedback.telerik.com/document-processing/1625149-spreadprocessing-implement-the-sumproduct-function)
143-
- [SUMPRODUCT Function in Excel](https://support.microsoft.com/en-us/office/sumproduct-function-16753e75-9f68-4874-94ac-4d2145a2fd2e)
131+
- [Functions]({%slug radspreadprocessing-features-formulas-functions%})
132+
- [Custom Functions]({%slug radspreadprocessing-features-formulas-custom-functions%})

libraries/radspreadprocessing/features/formulas/custom-functions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,4 @@ __Example 5__ shows how to create the 'E' function.
338338
* [ArgumentInterpretation](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.ArgumentInterpretation.html)
339339
* [ArrayArgumentInterpretation](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Spreadsheet.Expressions.Functions.ArrayArgumentInterpretation.html)
340340
* [CustomFunctions SDK](https://github.com/telerik/xaml-sdk/tree/master/Spreadsheet/WPF/CustomFunctions)
341+
* [Implementing SUMPRODUCT Function in SpreadProcessing]({%slug sumproduct-function-nested-array-formulas-telerik-spreadprocessing%})

libraries/radspreadprocessing/features/formulas/functions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,3 +973,8 @@ Removes duplicate spaces, and spaces at the start and end of a text string. The
973973
UPPER</td><td>
974974

975975
Converts text to uppercase</td></tr></table>
976+
977+
## See Also
978+
979+
* [CustomFunctions SDK](https://github.com/telerik/xaml-sdk/tree/master/Spreadsheet/WPF/CustomFunctions)
980+
* [Implementing SUMPRODUCT Function in SpreadProcessing]({%slug sumproduct-function-nested-array-formulas-telerik-spreadprocessing%})

0 commit comments

Comments
 (0)