Finding exact $p$ value for McNemar's test, using the table with probabilities under the binomial distribution

Assuming a table for a certain number of trials $n$, with a column per true probability $P$, and a row for each possible number of successes $X$
$p$ value is the probability of finding the observed $b$ value or a more extreme number, given that the null hypothesis is true.
  1. Find the table for the appropriate number of trials $n$, which is $n = b + c$. That is, $n$ is equal to the number of pairs in the sample for which the first score is 0 while the second score is 1 ($b$), plus the number of pairs in the sample for which the first score is 1 while the second score is 0 ($c$)
  2. Find the column with true probability $P$ equal to 0.5 (the value according to the null hypothesis)
  3. Use the smaller of $b$ and $c$ as your observed number of 'successes' $X$. Then use the table to find the probability that the number of successes is 0, the probability that the number of successes is 1, etc, up to and including your observed number of 'successes' $X$
  4. Sum all these probabilities, and multiply the result by 2. This is your (two sided) exact $p$ value
Example: suppose the number of pairs in the sample for which the first score is 0 while the second score is 1 is $b = 2$, and the number of pairs in the sample for which the first score is 1 while the second score is 0 is $c = 8$. The total number of trials $n = b + c = 10$. Then the $p$ value is equal to $(0.001 + 0.010 + 0.044) \times 2 = 0.11$.

Exact p value McNemar test