diff --git a/ClosedXML/ClosedXML/ClosedXML/Excel/CalcEngine/Functions/MathTrig.cs b/ClosedXML/ClosedXML/ClosedXML/Excel/CalcEngine/Functions/MathTrig.cs index 274bcf9..4c33e64 100644 --- a/ClosedXML/ClosedXML/ClosedXML/Excel/CalcEngine/Functions/MathTrig.cs +++ b/ClosedXML/ClosedXML/ClosedXML/Excel/CalcEngine/Functions/MathTrig.cs @@ -242,7 +242,10 @@ // if criteria is a number, straight comparison if (criteria is double) { - return (double) value == (double) criteria; + if (value is Double) + return (double) value == (double) criteria; + Double dValue; + return Double.TryParse(value.ToString(), out dValue) && dValue == (double) criteria; } // convert criteria to string diff --git a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs b/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs index f28b5dd..5ba9ef8 100644 --- a/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs +++ b/ClosedXML/ClosedXML/ClosedXML_Sandbox/Program.cs @@ -15,14 +15,12 @@ { private static void Main(string[] args) { - var wb = new XLWorkbook(); - var ws = wb.AddWorksheet("Sheet"); - ws.FirstCell().SetValue(1) - .CellBelow().SetFormulaA1("IF(A1>0,Yes,No)") // Invalid - .CellBelow().SetFormulaA1("IF(A1>0,\"Yes\",\"No\")") // OK - .CellBelow().SetFormulaA1("IF(A1>0,TRUE,FALSE)"); // OK - wb.SaveAs(@"c:\temp\saved.xlsx"); + var wb = new XLWorkbook(@"c:\temp\sopos.xlsx"); + var ws = wb.Worksheet("3"); + Console.WriteLine(ws.Cell("E22").Value); + //wb.SaveAs(@"c:\temp\saved.xlsx"); Console.WriteLine("Done"); + Console.ReadKey(); } } }