if(d4<>5 is saying if the cell D4 is not equal to 5 to perform countif(o$33,">0")+1
countif(o$33,">0")+1 is saying to count all the cells in that range that have a value of greater than 0 (basically all positives and to add 1
As you drag down the column will expand because o$33 row is locked at the third row. Because of the +1 the cell returned will have a minimum of 1.
,"-") if D4 is equivalent to 5 to put a "-" in the cell
another way to write is which is doing the opposite due to change of operater sign