Hello all

Please can someone tell me what formula I can use to add a running total with variables? For example:

If I have 4 cells with different numbers or letters in them I want it to be able to look at one cell and if it equals x then to add 1, then to look at the next cell and if this also equals x then add one and move to the next cell but if it doesn't then to stop?

Does that make sense and is it even possible?

Thanks

James