Search code examples
google-sheetsarray-formulascountif

Counting occurrences of a phrase in Google Sheets using ArrayFormula


I have a formula in Google Sheets that counts the number of times a phrase has occurred in another column up to and including the row.

="BMC - Thursdays"&":"&COUNTIF($C$1:C1,"*BMC - Thursdays*")

This formula is in A1, and when I drag this down, it automatically adjusts it so that in A2, it searches cells C1 and C2, in A3 it counts occurrences in C1, C2, and C3, etc.

Unfortunately, all of my new data is imported from paperform, which creates a new row each time. I would love it to automatically run that formula on the new row. I have tried doing this several ways using an arrayformula, but I've been unsuccessful, I just don't know enough to come close. It work perfectly when I drag the formula down from already existing columns, so have no idea why there isn't an easy way to do this (that I've been able to find yet).

Any help is much appreciated. Thanks!

An example sheet of what I'm looking for can be found here:BMC Tally Sheet


Solution

  • See if this works

    =ARRAYFORMULA(IF(LEN(C:C), "BMC - Thursdays"&":"&COUNTIFS(C:C, "*BMC - Thursdays*", ROW(C:C), "<="&ROW(C:C)),))
    

    enter image description here