Forum Discussion
Occurrence in an excel serie
As someone that has moved 100% to the new Excel, I can still see some sense in what you say. I tend to look at Excel as two computing environments that share a common function library. I am eager to dispense with everything that characterises the legacy spreadsheet because I never liked it anyway. The question of interest is then one of whether the new methods have matured sufficiently to offer a complete replacement for tried-and-tested wisdom of the ages.
My first approach was to use SCAN as a simple accumulator
= LET(
offset, DROP(VSTACK(-1,data),-1),
start?, data<>offset,
end?, DROP(VSTACK(start?, TRUE),1),
accumulation, SCAN(0, start?, LAMBDA(a,b, IF(b=TRUE, 1, a+1))),
frequencies, FILTER(accumulation, end?),
frequencies
)
The next exploits the FREQUENCY function, though not in exactly the same manner as you.
= LET(
index, SEQUENCE(15),
offset, DROP(VSTACK(data,-1),1),
end?, data<>offset,
bins, FILTER(index, end?),
freq, FREQUENCY(index, bins),
DROP(freq, -1)
)
I will have to consider your use of ξ, η, ζ as variable names, especially since ξ1, η1, ζ1 are valid names that haven't been squandered to support the ludicrous A1 direct referencing notation!
Ah, so you've decided to combine the two required outputs into a single column, in which the rows represent alternating frequency counts for ones and zeroes corresponding to the order in which those values occur in data?
I like it, especially since you could then, if desired, wrap that in WRAPROWS to achieve the desired two-column output.
Regards
- PeterBartholomew1Apr 29, 2023Silver Contributor
Agreed; I should have included WRAPROWS in the final statement
WRAPROWS(DROP(freq,-1), 2, "")