Number Format Codes

Number format code is way to show numeric value. It controls whether a number is displayed as an integer, a floating number, a date, a currency value or some other user defined format.

Xlsx2Go supports built-in Excel codes and will try to detect/convert to proper internal ID, as well as custom codes - use it as is without worrying.

Built-in Codes

General type

  • @
  • General

Integer number

  • 0
  • 0%
  • (#,##0_);(#,##0)
  • (#,##0_);[RED](#,##0)

Float number

  • 0.00
  • #,##0
  • #,##0.00
  • ($#,##0_);($#,##0)
  • ($#,##0_);[RED]($#,##0)
  • ($#,##0.00_);($#,##0.00_)
  • ($#,##0.00_);[RED]($#,##0.00_)
  • 0.00%
  • 0.00E+00
  • # ?/?
  • # ??/??
  • (#,##0.00);(#,##0.00)
  • (#,##0.00);[RED](#,##0.00)
  • _(*#,##0_);_(*(#,##0);_(*"-"_);_(@_)
  • _($*#,##0_);_($*(#,##0);_(*"-"_);_(@_)
  • _(*#,##0.00_);_(*(#,##0.00);_(*"-"??_);_(@_)
  • _($*#,##0.00_);_($*(#,##0.00);_(*"-"??_);_(@_)
  • ##0.0E+0

Date

  • m-d-yy
  • d-mmm-yy
  • d-mmm
  • mmm-yy

Time

  • h:mm AM/PM
  • h:mm:ss AM/PM
  • h:mm
  • h:mm:ss

Date+Time

  • m-d-yy h:mm

DeltaTime

  • mm:ss
  • [h]:mm:ss
  • mm:ss.0

Custom Codes

Format code can control any aspect of number formatting allowed by Excel:

Currency

The $ in format appears as the local currency symbol.

Colors

The color format should have one of the following values:

[Black] [Blue] [Cyan] [Green] [Magenta] [Red] [White] [Yellow]

Examples

Number code Go Value Excel Output
dd/mm/yyyy hh:mm AM/PM time.Now() 18/07/2019 12:30 AM
mm/dd/yy time.Now() 07/18/19
mmm d yyyy time.Now() Jul 18 2019
d mmmm yyyy time.Now() 18 July 2019
0.000 1.2345678 1.235
#,##0 1234.567 1,235
0 "dollar and" .00 "cents" 1.87 1 dollar and .87 cents
[Green]General;[Red]-General;General 12345 1235
-12345 -12345
0 0

For more information about custom formats, check Microsoft Documentation

Last Updated: 7/18/2019, 3:29:30 PM