title: How to force 4 digits in excel?
body: <p>I have a really long truth table and the binary column is showing up like this:</p>
  
  <pre><code>A   +   B   =   S   BINARY
  0   +   0   =   0   0
  0   +   1   =   1   1
  0   +   2   =   2   10
  0   +   3   =   3   11
  0   +   4   =   4   100
  0   +   5   =   5   101
  0   +   6   =   6   110
  0   +   7   =   7   111
  0   +   8   =   8   1000
  0   +   9   =   9   1001
  0   +   10  =   10  1010
  0   +   11  =   11  1011
  0   +   12  =   12  1100
  0   +   13  =   13  1101
  0   +   14  =   14  1110
  0   +   15  =   15  1111
  </code></pre>
  
  <p>Where the BINARY column <code>=DEC2BIN(S)</code></p>
  
  <p>I need to force the Binary values to have 4 digits all the time. So <code>0 = 0000</code>, <code>3 = 0011</code>, etc. How do I do this in excel?</p>
  
  <p><strong>Solution:
  <code>=DEC2BIN(S,6)</code></strong></p>