diff options
author | gonghaibinx <116247046+gonghaibinx@users.noreply.github.com> | 2022-10-21 00:04:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-21 00:04:32 +0800 |
commit | f843a9ea56710deb4cdb77ea2cd3a08d8d82d3e6 (patch) | |
tree | c51e18bdd69c3f4346264e75cc1c658c86433c65 | |
parent | 2df615fa2831bd578371d4e3606f16461c474ce7 (diff) |
Fix the formula calculation result issue of the OR function (#1374)
Co-authored-by: gonghaibin <gonghaibin@qq.com>
-rw-r--r-- | calc.go | 3 | ||||
-rw-r--r-- | calc_test.go | 1 |
2 files changed, 4 insertions, 0 deletions
@@ -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", |