With custom number formatting you can change how your data is displayed. For example, you can set all negative numbers in parentheses or add your currency symbol to spend data. To apply a custom number format to a selection on your sheet, click on Format in your workbook's menu bar.
This will open up a familiar looking console where you can configure how your data should be presented. You'll write a set of rules in the console that will be applied to the data on your sheet. You can specify as many rules as you need. Clicking on "Templates" you'll be able to browse common formattings that you can use as a starting point.
Syntax for setting formats
To use colors in your format, write a color name in brackets (for example, [Blue]) anywhere in the desired part of the format. You must use English color names. The colors that can be used are white
, red
, blue
, green
, magenta
, yellow
, and cyan
. You can also use Color#
, where the #
symbol is a number between 1 and 56 corresponding to the 56 Excel ColorIndex colors. If you specify a color in the custom format, that color will take precedence over colors selected in the text color picker.
The following symbols can be used to format numbers:
Symbol | Result | Example |
| Digit or Zero |
|
| Digit if needed |
|
| Digit or Space |
|
| Decimal point |
|
| Thousands separator |
|
| Percentage | Number is multiplied by 100 before it is shown. |
| Exponential format |
|
| Pass-through | Pass through whatever text is inside the quotation marks as-is. |
| Escape | Pass the the next character through as-is. |
| Pass-through | These symbols are printed as-is, without the need to use quotations or escape characters. |
| Text value | When value is non-numeric, show it as is: |
Given a number representation of a date, you can also format dates and times:
Symbol | Result | Example |
| Two digit year | 23 |
| Four digit year | 2023 |
| Month | 1 |
| Two digit month | 01 |
| Month name abbreviation | Jan |
| Full month name | January |
| Single letter month abbreviation | J |
| Days | 1–31 |
| Days | 01–31 |
| Weekday abbreviation | Wed |
| Full weekday name | Wednesday |
| Hours | 0–23 or 1–12 |
| Hours | 00–23 or 01–12 |
| Minutes | 0–59 |
| Minutes | 00–59 |
| Seconds | 0–59 |
| Seconds | 00–59 |
| 12h clock | Sets clock to 12h and emits AM or PM. |
| 12h clock | Sets clock to 12h and emits A or P. |
| Hours | Elapsed time in hours |
| Minutes | Elapsed time in minutes |
| Seconds | Elapsed time in seconds |