diff options
author | ww1516123 <ww1516123@126.com> | 2022-06-14 15:04:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 15:04:43 +0800 |
commit | 7f570c74f8623aec6e8f89ff3701f28c3a256ffe (patch) | |
tree | f9789691e231101a085eac7b40c5e2cdcd4870cf | |
parent | d490a0f86f02f7f2eeabd8a0f38cbaa82a669187 (diff) |
Fix the problem of multi arguments calculation (#1253)
-rw-r--r-- | calc.go | 7 | ||||
-rw-r--r-- | calc_test.go | 7 |
2 files changed, 11 insertions, 3 deletions
@@ -899,6 +899,13 @@ func (f *File) evalInfixExp(sheet, cell string, tokens []efp.Token) (formulaArg, if result.Type == ArgUnknown { return newEmptyFormulaArg(), errors.New(formulaErrorVALUE) } + // when thisToken is Range and nextToken is Argument and opfdStack not Empty, should push value to opfdStack and continue. + if nextToken.TType == efp.TokenTypeArgument { + if !opfdStack.Empty() { + opfdStack.Push(result) + continue + } + } argsStack.Peek().(*list.List).PushBack(result) continue } diff --git a/calc_test.go b/calc_test.go index 714211d..d5c263e 100644 --- a/calc_test.go +++ b/calc_test.go @@ -1399,9 +1399,10 @@ func TestCalcCellValue(t *testing.T) { // FALSE "=FALSE()": "FALSE", // IFERROR - "=IFERROR(1/2,0)": "0.5", - "=IFERROR(ISERROR(),0)": "0", - "=IFERROR(1/0,0)": "0", + "=IFERROR(1/2,0)": "0.5", + "=IFERROR(ISERROR(),0)": "0", + "=IFERROR(1/0,0)": "0", + "=IFERROR(B2/MROUND(A2,1),0)": "2.5", // IFNA "=IFNA(1,\"not found\")": "1", "=IFNA(NA(),\"not found\")": "not found", |