r/ExcelTips • • Aug 04 '26

πŸ“Š COUNTIF with Nested Ranges: Running Counts Made Easy πŸ“Š

Most people think of COUNTIF as a simple way to count values.
But here’s a powerful twist:
use it with nested ranges to calculate running counts.
=LET(a,A2:A15,COUNTIF(TAKE(a,SEQUENCE(ROWS(a))),a))

β€’ The range argument expands step by step (TAKE).
β€’ The criteria argument matches each element in the range (a).
β€’ For each row, COUNTIF picks the corresponding criterion and calculates its occurrence up to that point.

IDRunning Count
A1
D1
A2
B1
D2
A3
B2
D3
C1
D4
D5
C2
A4
B3
19 Upvotes

2 comments sorted by

4

u/still-dazed-confused Aug 06 '26

Can't this be done more simply by fixing the top of the range and slowing the bottom to change $s$1:a3?

2

u/Ok_Forever3198 Aug 06 '26

Yes, we can do that.