title: Formatting Excel Cells for Binary
body: <p>I'm currently trying to use a table in excel to automatically generate some code in a Hardware Description Language for me.</p>
  
  <p>I've formatted the cells O5:O20 to a custom format so that when it pulls the value from my table for the '0' charecter it will display all the 0's in front as well. However I'm trying to have my HDL code automatically generate based off of the table so in cells R5:R19 I have the following code running:</p>
  
  <pre><code>=("assign wire_"&amp;N5&amp;" = 4'b"&amp;TEXT(O5, 0000000)&amp;";")
  </code></pre>
  
  <p>This defaults to:</p>
  
  <pre><code> =("assign wire_"&amp;N5&amp;" = 4'b"&amp;TEXT(O5, 0)&amp;";")
  </code></pre>
  
  <p>Ideally the first code should work to create the output</p>
  
  <pre><code>=assign wire_0=4'b0000001;
  </code></pre>
  
  <p>But because the Excel code forces the text formatting of O5 to be '0' instead of what I type in as '0000000', any bit bus with zeros in front will be lost.</p>
  
  <p>My question is if there is a way to force the 'TEXT(cell, format)' command to accept the 7 0 format in the formula, as it was accepted when I placed it on cells O5:O20. </p>
  
  <p><a href="https://i.stack.imgur.com/LoDUN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LoDUN.png" alt="enter image description here"></a></p>