I have a column of (text) values. I want to count the number of times a non-blank cell arises such that its value differs from that of the cell immediately above it. I do not want just a sheer count of unblank cells or of the total number of cells minus the number of blank ones.
For example, if the column is of form (A, B, B, A, A, A, _, A, B, C, B)
, where "A
" and "B
" and "C
" represent some text (such that they are distinct from one another) and "_
" (underscore) represents a blank cell, the count that I want would be 7 because:
- The "
A
" in the first entry counts. - The "
B
" in the second entry counts. - The "
B
" in the third entry does not count. - The "
A
" in the fourth entry counts. - The "
A
"s in the fifth and sixth entry do not count, each. - The "
_
" in the seventh entry does not count because it is blank. - Each subsequent entry counts because each is non-blank and different from the immediately preceding entry.
How do I make such a function?
CountIf
function will probably be used, but I am not sure how to make the condition loop down the entire column (and I also do not know how to avoid counting blank cells).