Nick Romney

Nick Romney

Excel custom number format

For some business reporting in Excel, I wanted:

  • a comma as the thousands separator
  • no decimals
  • negative figures in brackets
  • a hyphen to represent a Zero value

This OzGrid post was helpful:

Excel see a cell's format as having four Sections. These are, from left to right:

  • Positive Numbers
  • Negative Numbers
  • Zero Values
  • Text Values

Each of these Sections are separated by a semi colon ;

If you create a custom number format you do not have to specify all four sections.

The custom format I needed turned out to be relatively short - note how it doesn't handle Text Values, as it only has three Sections:

#,##0;(#,##0);"-"

This Chandoo post gave a really helpful technique I'd not seen before - to put the format in a cell of its own, and then rely on the format by using the TEXT function

  • Column A - a sample number
  • Column B - the format
  • Column C - the result of the number in column A, represented in the format in column B, using a simple formula =TEXT(A2,B2)

This meant that I could iterate over the different formulae and quickly see the result of toggling the thousands separator, or values after the decimal.

image.png

 
Share this