OR returns the text "TRUE" and drops the arguments after a cell range
Author: PhilflowIOCreated Sep 20, 2026Updated Sep 20, 2026
Description
Three problems in OR (calc.go:12207).
A true numeric argument returns newStringFormulaArg(strings.ToUpper(strconv.FormatBool(or))) at calc.go:12231, so the result is the text "TRUE" and not a logical value. =OR(1)*1 then fails with #VALUE! and =SUM(OR(1)) is 0.
A cell range argument does return fn.OR(args) at calc.go:12238, which replaces the whole call with the range. Every argument after the range is dropped, so =OR(A1:B1,C1) is FALSE even when C1 is 1.
A true argument ends the evaluation, so an invalid argument after it is never validated. =OR(1,"text") returns TRUE instead of #VALUE!.
AND got the matrix handling fixed in #2368. OR still has all three.
Steps to reproduce the issue
package main
import (
"fmt"
"github.com/xuri/excelize/v2"
)
func main() {
f := excelize.NewFile()
f.SetCellValue("Sheet1", "A1", false)
f.SetCellValue("Sheet1", "B1", false)
f.SetCellValue("Sheet1", "C1", 1)
for _, formula := range []string{
`=OR(1)*1`,
`=SUM(OR(1))`,
`=ISTEXT(OR(1))`,
`=OR(A1:B1,C1)`,
`=OR(1,"text")`,
} {
f.SetCellFormula("Sheet1", "E1", formula)
result, err := f.CalcCellValue("Sheet1", "E1")
fmt.Printf("%-16s %-10q %v\n", formula, result, err)
}
}Describe the results you received
=OR(1)*1 "#VALUE!" #VALUE!
=SUM(OR(1)) "0" <nil>
=ISTEXT(OR(1)) "TRUE" <nil>
=OR(A1:B1,C1) "FALSE" <nil>
=OR(1,"text") "TRUE" <nil>Describe the results you expected
=OR(1)*1 "1" <nil>
=SUM(OR(1)) "1" <nil>
=ISTEXT(OR(1)) "FALSE" <nil>
=OR(A1:B1,C1) "TRUE" <nil>
=OR(1,"text") "#VALUE!" #VALUE!Go version
go version go1.26.8 linux/amd64
Excelize version or commit ID
0434413
Environment
GOOS='linux'
GOARCH='amd64'
CGO_ENABLED='1'
GOVERSION='go1.26.8'Source: qax-os/excelize