Hi,
I'm having problems getting a workbook to recalculate correctly when using named ranges in cell formulas.
I have a simple workbook where I've named the range A2:A4 'Index' and populated it with the numbers 1 in A2, 2 in A3 and 3 in A4. I've then named the range B2:B4 'Result' and entered the formula '=Index*2' in each cell of the range.
When I check the values in the 'Results' range after calling ExcelWorkbook.Calculate() they are all set to 2.
I believe this is due to the lines of code below in the ResultNumeric property of the CompileResult class
```
else if (Result is ExcelDataProvider.IRangeInfo)
{
var c = ((ExcelDataProvider.IRangeInfo)Result).FirstOrDefault();
```
It looks like only the first cell in a range is used when evaluating an expression with cell ranges.
I've tried replacing the named range in the formula with the explicit cell range reference i.e. '=A2:A4*2' and I get the same results.
I've attached my test project. I'd appreciate any help you can give.
Richard
I'm having problems getting a workbook to recalculate correctly when using named ranges in cell formulas.
I have a simple workbook where I've named the range A2:A4 'Index' and populated it with the numbers 1 in A2, 2 in A3 and 3 in A4. I've then named the range B2:B4 'Result' and entered the formula '=Index*2' in each cell of the range.
When I check the values in the 'Results' range after calling ExcelWorkbook.Calculate() they are all set to 2.
I believe this is due to the lines of code below in the ResultNumeric property of the CompileResult class
```
else if (Result is ExcelDataProvider.IRangeInfo)
{
var c = ((ExcelDataProvider.IRangeInfo)Result).FirstOrDefault();
```
It looks like only the first cell in a range is used when evaluating an expression with cell ranges.
I've tried replacing the named range in the formula with the explicit cell range reference i.e. '=A2:A4*2' and I get the same results.
I've attached my test project. I'd appreciate any help you can give.
Richard