title: Is there an EXCEL formula that counts how many times Excel data 'switches' between binomial coding (i.e., data coded as 1 or 2)?
body: <p>Folks, would really appreciate some help;</p>
  <p>If I have the following values of data in Excel (3 examples below) where data is coded as 1 or 2, does anyone know an Excel formula which can count how many 'switches' occur in the sequence of values? What I mean by a 'switch', is when the 1's switch to 2's, and vice versa (when the 2's switch to 1's).</p>
  <p>For example;</p>
  <blockquote>
  <p>1, 1, 1, 1, 1, 1, 1, 2, 2 (there is 1 switch here)</p>
  </blockquote>
  <blockquote>
  <p>1, 2, 2, 1, 1, 1, 1, 1, 1 (there are two switches here)</p>
  </blockquote>
  <blockquote>
  <p>1, 2, 2, 1, 1, 1, 1, 2, 2 (there are three switches here)</p>
  </blockquote>
  <p>So far, I am able to use the following formula (see below) to see IF there is a switch at all in the sequence (from 2 to 1 for example). But now I am trying to calculate how many switches are occurring in the sequence, and not IF a singular switch is occurring. So I think I possibly need to use a COUNT formula, instead of a FIND formula?</p>
  <pre><code>=IF(ISERROR(FIND(&quot;21&quot;,TEXTJOIN(&quot;&quot;,TRUE,[data range of a row]))),FALSE,TRUE)
  </code></pre>
  <p>Any help is appreciated.</p>