title: Format percentage with optional decimal places in Excel
body: <p>I have some cells in Excel with decimal places in, which I want to format as percentages. However, I only want decimal places to appear if the decimals are non-zero. For example, I have many cells which contain numbers such as:</p>
  
  <p><code>0.09</code></p>
  
  <p><code>0.195</code></p>
  
  <p><code>0.876</code></p>
  
  <p><code>0.4</code></p>
  
  <p>I would like these to be displayed as percentages in the form:</p>
  
  <p><code>9%</code></p>
  
  <p><code>19.5%</code></p>
  
  <p><code>87.6%</code></p>
  
  <p><code>40%</code></p>
  
  <p>Any solutions would be greatly appreciated.</p>