Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there a way in Google Sheets to get a running countif with Arrayformula and from the bottom up?

I have the following situation in Google Sheets:

enter image description here

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I have a set of entries sorted descending with the FALSE option in Cell A1.
I would like to make a running countif in column C, considering the string in Cell B1 and with arrayformula.
The formula should take the sorting option into consideration so, in case I decide to sort the entries in an ascending order, with TRUE in Cell A1, the running countif makes the count from the top down, as it is depicted in the following picture.
Screenshot 3

Is that possible?
Thanks so much.

>Solution :

Here you have an option with SCAN, instead of counting at each time, it keeps a running count, but hiding when the value doesn’t match B1:

={"Formula";INDEX(IF(B2:B<>B1,"",
SCAN(IF(A1,0,1+COUNTIF(B2:B,B1)),B2:B,LAMBDA(a,v,IF(v<>B1,a,SUM(a,IF(A1,1,-1)))))))}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading