From f843a9ea56710deb4cdb77ea2cd3a08d8d82d3e6 Mon Sep 17 00:00:00 2001 From: gonghaibinx <116247046+gonghaibinx@users.noreply.github.com> Date: Fri, 21 Oct 2022 00:04:32 +0800 Subject: [PATCH] Fix the formula calculation result issue of the OR function (#1374) Co-authored-by: gonghaibin --- calc.go | 3 +++ calc_test.go | 1 + 2 files changed, 4 insertions(+) diff --git a/calc.go b/calc.go index 5d55992..796ca16 100644 --- a/calc.go +++ b/calc.go @@ -11623,6 +11623,9 @@ func (fn *formulaFuncs) OR(argsList *list.List) formulaArg { return newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE) case ArgNumber: or = token.Number != 0 + if or { + return newStringFormulaArg(strings.ToUpper(strconv.FormatBool(or))) + } case ArgMatrix: // TODO return newErrorFormulaArg(formulaErrorVALUE, formulaErrorVALUE) diff --git a/calc_test.go b/calc_test.go index df86f90..ea3f014 100644 --- a/calc_test.go +++ b/calc_test.go @@ -1421,6 +1421,7 @@ func TestCalcCellValue(t *testing.T) { "=OR(0)": "FALSE", "=OR(1=2,2=2)": "TRUE", "=OR(1=2,2=3)": "FALSE", + "=OR(1=1,2=3)": "TRUE", "=OR(\"TRUE\",\"FALSE\")": "TRUE", // SWITCH "=SWITCH(1,1,\"A\",2,\"B\",3,\"C\",\"N\")": "A",