Thanks for the reply. I understand how VLOOKUP function work in Microsoft Excel. Aspose is not working the same way. If you need more samples I am glad to get you some more.
See the code below for a quick test; Excel file attached.
static void Main(string[] args) {
Workbook book = new Workbook();
book.Open(@"C:\temp\500251190 InsSummaryUL June 30, 2010.xls", FileFormatType.Excel97To2003);
book.Settings.CalcMode = CalcModeType.Automatic;
book.Settings.ConvertNumericData = true;
Worksheet sheet2 = book.Worksheets["Per1000"];
string c1 = sheet2.Cells["C1"].StringValue; // Gettiing incorrect value
string c2 = sheet2.Cells["C2"].StringValue; // Gettiing incorrect value
string c3 = sheet2.Cells["C3"].StringValue; // Gettiing incorrect value
/// Try 1
string currdur = book.Worksheets.GetRangeByName("currdur")[0, 0].StringValue; // Getting incorrect value
book.CalculateFormula();
c1 = sheet2.Cells["C1"].StringValue; // Gettiing correct value
c2 = sheet2.Cells["C2"].StringValue; // Gettiing correct value
c3 = sheet2.Cells["C3"].StringValue;// Gettiing correct value
//// Try 2
currdur = book.Worksheets.GetRangeByName("currdur")[0, 0].StringValue; // Returning "#REF"
// Try 3
book.Worksheets.GetRangeByName("currdur")[0, 0].Formula = book.Worksheets.GetRangeByName("currdur")[0, 0].Formula;
//"=VLOOKUP(C1,IF(C3=1,B8:P23,IF(OR(C3=2,C3=3),B27:P41,B45:P53)),15,TRUE)";
book.CalculateFormula();
currdur = book.Worksheets.GetRangeByName("currdur")[0, 0].StringValue; // Returning incorrect value
// Try 4
// Remove the IF condition from the VLOOKUP
book.Worksheets.GetRangeByName("currdur")[0, 0].Formula = "=VLOOKUP(C1,B27:P41,15,TRUE)";
book.CalculateFormula();
currdur = book.Worksheets.GetRangeByName("currdur")[0, 0].StringValue; // Returning correct value
// Summary
// VLLOOKUP function does not work the way it works in EXCEL.
// Atleast in this case not supporting IF condition inside the VLOOKUP
book.Save(@"C:\temp\500251190 InsSummaryUL June 30, 2010.xls", FileFormatType.Excel97To2003);
}