Forum Discussion
pbakseli
Nov 25, 2025Copper Contributor
How to sum chain values from N-number cells?
Hello, I have data of people by age, but 100 different values on a line chart would look... bad. Hence the need to group ages in sets of 5 or 10 on a separe line in chain, but what is the functio...
Lorenzo
Dec 02, 2025Silver Contributor
in D2:
=LET(
groupedAge, GROUPBY(
SCAN("", A2:A101, LAMBDA(ageRange,age, IF( MOD(age, 5) = 0, TEXTJOIN("-",, age, age +4), ageRange ) ) ),
B2:B101, SUM,, 0
),
SORTBY( groupedAge, --TEXTBEFORE(CHOOSECOLS(groupedAge, 1), "-") )
)