From caf31932611bc2e774c294a1c9809836c5c77882 Mon Sep 17 00:00:00 2001 From: neilcawse <8085959+neilcawse@users.noreply.github.com> Date: Mon, 12 Oct 2026 14:19:29 -0400 Subject: [PATCH] Functions: *IFS with two or more criteria pairs accept criteria over 255 characters, as in Excel --- crates/functions/src/criteria.rs | 5 +++-- crates/functions/src/math.rs | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/crates/functions/src/criteria.rs b/crates/functions/src/criteria.rs index db010fc..2c87a9a 100644 --- a/crates/functions/src/criteria.rs +++ b/crates/functions/src/criteria.rs @@ -51,8 +51,9 @@ impl Criterion { } } - /// Parses the criteria argument of COUNTIF(S), SUMIF(S), AVERAGEIF(S), MAXIFS and MINIFS: - /// like `parse`, but text longer than 255 characters is `#VALUE!`, as in Excel. + /// Parses the criteria argument of COUNTIF, SUMIF, AVERAGEIF and the single-pair *IFS + /// functions: like `parse`, but text longer than 255 characters is `#VALUE!`, as in Excel. + /// The *IFS functions with two or more criteria pairs use `parse`: Excel doesn't limit them. pub(crate) fn parse_arg(v: &Value) -> Result { match v { Value::Array(a) => Criterion::parse_arg(a.data.first().unwrap_or(&Value::Empty)), diff --git a/crates/functions/src/math.rs b/crates/functions/src/math.rs index 1233a40..75cea93 100644 --- a/crates/functions/src/math.rs +++ b/crates/functions/src/math.rs @@ -950,6 +950,10 @@ fn criteria_mask(a: &[Arg], first_pair: usize, rows: usize, cols: usize) -> R R0")]), 1.0); + close(ev("COUNTIFS", vec![rf(qty.clone()), t(">0"), rf(cells.clone()), t(&long)]), 1.0); + close(ev("SUMIFS", vec![rf(qty.clone()), rf(cells.clone()), t(&long), rf(qty), t(">0")]), 2.0); } }