This project has moved. For the latest updates, please go here.

Get Value of Formula using Named Range over Sheets

Feb 3, 2014 at 3:48 PM
Assume an Excel File with two Sheets "input" and "calc"
input[a1] is named input1 with value 5,
input[b1] has the formula "=input1"
calc[a1] has the formula "=input1" too.

When i try:

var resultByteArray = File.ReadAllBytes(@"C:\temp\test.xlsx");
        using (var mem2 = new MemoryStream())
        {
            mem2.Write(resultByteArray,0,resultByteArray.Length);
            var wbResult = new XLWorkbook(mem2);
            var res = wbResult.Worksheet("input").Cell(1, 2).Value;
            var res2 = wbResult.Worksheet("calc").Cell(1,1).Value;
        }
res will contain 5 and res2 will throw an NullReferenceException...

has anyone an idea how to resolve values over sheet-borders?