each cell contains either Top, Top
, Top, Bottom
or Bottom, Bottom
I'm currently using =COUNTIF(B3:E3,"*"&"Top"&"*")
which only counts 1.
How would I make it so it counted the 2 separate "Top"'s in a cell?
For a single row input, you may use:
=COUNTIF(SPLIT(join(",",B3:E3),","),"*top*")
For a multiple rows input, you may use:
=MAP(B3:B5,C3:C5,D3:D5,E3:E5,LAMBDA(b,c,d,e, COUNTIF(SPLIT(join(",",b,c,d,e),","),"*top*")))
Top, Top | Top, Top | Top, Top | Top, Top | 8 |
Top, Bottom | Top, Top | Top, Bottom | Top, Top | 6 |
Top, Top | Bottom, Bottom | Top, Top | Bottom, Bottom | 4 |
Formula 1:
=COUNTIF(SPLIT(join(",";B3:E3);",");"*top*")
Formula 2:
=MAP(B3:B5;C3:C5;D3:D5;E3:E5;LAMBDA(b;c;d;e; COUNTIF(SPLIT(join(",";b;c;d;e);",");"*top*")))