Forum Discussion
MichalK55
Sep 06, 2023Copper Contributor
how to count cells with one number between two different numbers
Hello, In column D, I need to count the occurrence of the value 5 that appears between the values 18 and 19. I don't want to count any other value 5 in this column. Can anyone advise how to do this ...
PeterBartholomew1
Sep 06, 2023Silver Contributor
Using excel 365, it is possible to identify the cells of the 'value' column lying between 18 and 19 with the SCAN function
= LET(
active, SCAN(0, values, LAMBDA(u,v, SWITCH(v, 18, 1, 19, 0, u))),
SUM(active * (values=5))
)