diff --git a/ReoGrid/Formula/Evaluator.cs b/ReoGrid/Formula/Evaluator.cs index bee5e214..f22768fa 100644 --- a/ReoGrid/Formula/Evaluator.cs +++ b/ReoGrid/Formula/Evaluator.cs @@ -304,7 +304,15 @@ private static FormulaValue Evaluate(IWorkbook workbook, Cell cell, STNode node) FormulaValue v1 = Evaluate(workbook, cell, node[0]); FormulaValue v2 = Evaluate(workbook, cell, node[1]); - if (v1.type != v2.type) return true; + if (v1.type == FormulaValueType.String && ((string)v1.value) == string.Empty) + { + if (v2.type == FormulaValueType.Nil) return false; + } + + if (v2.type == FormulaValueType.String && ((string)v2.value) == string.Empty) + { + if (v1.type == FormulaValueType.Nil) return false; + } switch (v1.type) { @@ -318,7 +326,7 @@ private static FormulaValue Evaluate(IWorkbook workbook, Cell cell, STNode node) return (bool)v1.value != (bool)v2.value; default: - return true; + return false; } } #endregion // Not Equals diff --git a/ReoGrid/Formula/Functions.cs b/ReoGrid/Formula/Functions.cs index 5696e8be..567d8bdc 100644 --- a/ReoGrid/Formula/Functions.cs +++ b/ReoGrid/Formula/Functions.cs @@ -883,7 +883,10 @@ public static FormulaValue Or(Cell cell, List list) } else if (val.type == FormulaValueType.Number) { - return ((double)val.value != 0); + if ((double)val.value != 0) + { + return true; + } } }