Search code examples
google-sheetsgoogle-sheets-formula

Is there a way to count occurences of a word until another word shows in google sheets


At the moment my spread sheet has a column that says Win or Lose, I want to be able to count how many times Win shows up before Lose does (in this case it should show 6, 2, 2, 2)

Screenshot of Sheet


Solution

  • You can use:

    =flatten(index(len(split(join(,left(A:A)),"L")))) 
    

    enter image description here

    Take the first letter, join everything in one cell, split by L and return the length.

    This will work as long as you don't have 50k+ entries.