# Number Formats

> Format formula results with TableCellNumberFormat: # and 0 placeholders, decimal and thousands separators, percentages, currency symbols and quoted text.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control ActiveX > Document Editor > Tables > Number Formats
- **1511 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/number-formats/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/number-formats/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/number-formats/llms-full.txt

---

Results that table cells calculate are easier to read when they share a format. A number format tells TX Text Control ActiveX how to display the result of a cell formula: how many digits and decimal places, with which separators, as a percentage or together with a currency symbol or a word.

Formulas are defined with the [TableCellFormula](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tablecellformula-property/llms-full.txt) property, as [Using Formulas in Table Cells](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/formulas/llms-full.txt) describes. The sections below build number format strings from placeholders, separators, the percentage sign and added text, with an example for each character.

### How Number Formats Work

By default, the number format is an empty string, and the cell shows the unformatted value of the calculation. A result without decimal places is displayed as an integer, and a decimal number is displayed with all its decimal places.

To display different results with a common format, set a number format string with the [TableCellNumberFormat](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/tablecellnumberformat-property/llms-full.txt) property. Like the formula, it is set for a cell identified by its table identifier, row and column. A number format string is composed of:

- **placeholders**, `#` and `0`,
- **separators**, `.` and `,`,
- **percentage signs**, `%`, and
- **other single characters or text**.

### Reserve Digits With Placeholders

Placeholders stand for the digit positions of the number to format. Two characters are valid placeholders, `#` and `0`. The placeholder `0` fills a position with a zero if no digit of the calculated result occupies it.

| Value | Format | Displayed as |
|---|---|---|
| 7 | `#` | 7 |
| 789 | `#` | 789 |
| 1234 | `#` | 1234 |
| 7 | `000` | 007 |
| 789 | `000` | 789 |

### Add Separators

Two separators display a number as a decimal number, with a thousands separator, or both. The separators are rendered with the default decimal and thousands separator signs of the system language: a German system, for example, uses a comma as the decimal sign and a point as the thousands separator.

#### Decimal Numbers

To display all numbers with decimal places, combine the placeholders with a decimal point (`.`). The number of placeholders after the point sets the maximum number of decimal places shown. Without a decimal point, results are rounded to the nearest integer.

| Value | Format | Displayed as |
|---|---|---|
| 12.6 | `#.##` | 12.6 |
| 5 | `#.00` | 5.00 |
| 12.6 | `#.00` | 12.60 |
| 0.543 | `#.00` | 0.54 |
| 17.548 | `#` | 18 |

#### Thousands Separator

The second separator is the thousands separator (`,`). Followed by placeholders, it displays the result with a comma after every third digit. If no placeholder follows the comma, each comma trims the number by three positions before the decimal point.

| Value | Format | Displayed as |
|---|---|---|
| 9876543210.1234 | `,###.##` | 9,876,543,210.12 |
| 9876543210 | `,###` | 9,876,543,210 |
| 12200000 | `#,,` | 12 |
| 12200000 | `#.0,,` | 12.2 |

### Show Percentages

The percentage sign has a special meaning. Combined with one or more placeholders, it multiplies the calculated value by 100 and displays it with the percentage sign.

| Value | Format | Displayed as |
|---|---|---|
| 0.52 | `#%` | 52% |
| 1 | `#%` | 100% |
| 0.00321 | `0.##%` | 0.32% |
| 0.52 | `%#` | %52 |

### Add Characters and Text

There are three ways to combine the calculated value with a single character or with text.

#### Predefined Characters

The following characters can be combined with a number format string directly:

| Character | Value | Format | Displayed as |
|---|---|---|---|
| `$` (dollar sign) | 500 | `#$` | 500$ |
| `-` (minus sign) | 1 | `-#.00` | -1.00 |
| `+` (plus sign) | 12.345 | `+.##` | +12.35 |
| `/` (slash mark) | 4 | `\1/#` | 1/4 |
| `(` (left parenthesis) | 7 | `-(#+\3)` | -(7+3) |
| `)` (right parenthesis) | 3 | `-(\7+#)` | -(7+3) |
| `:` (colon) | 50 | `#:"50"` | 50:50 |
| `!` (exclamation point) | 6 | `#!` | 6! |
| `^` (circumflex accent, caret) | 2.5 | `#.00^\2` | 2.50^2 |
| `&` (ampersand) | 0 | `#&\1` | 0&1 |
| `'` (apostrophe) | 9 | `'#'` | '9' |
| `~` (tilde) | 7.654 | `~#.0` | ~7.7 |
| `{` (left curly bracket) | 67 | `{-#}` | {-67} |
| `}` (right curly bracket) | 17 | `{+#}` | {+17} |
| `<` (less-than sign) | 5 | `#<"10"` | 5<10 |
| `>` (greater-than sign) | 7.4 | `#.00>\6` | 7.40>6 |
| `=` (equal sign) | 5.6 | `#>=\6` | 6>=6 |
| Space character | 12 | `#.00 $` | 12.00 $ |

#### Other Characters

Any other character, such as a specific currency symbol, is displayed when you put a backslash directly in front of it:

| Value | Format | Displayed as |
|---|---|---|
| 12.99 | `#.00\€` | 12.99€ |
| 42 | `\"#\"` | "42" |
| 18 | `#:\X` | 18:X |

#### Words and Text

To add whole words or text, put them in quotation marks:

| Value | Format | Displayed as |
|---|---|---|
| 29.99 | `"EUR"#.00` | EUR 29.99 |
| 4.50 | `#.00"€"` | 4.50€ |
| 76 | `# "Units"` | 76 Units |

### Related Pages

- [Using Formulas in Table Cells](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/formulas/llms-full.txt): the formulas whose results a number format displays.
- [Programming with Table Identifiers](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/identifiers/llms-full.txt): the identifiers that address a table from code.
- [Tables](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/llms-full.txt): inserting tables and the members for programming with them.

---

## Nearby

- **Previous:** [Using Formulas in Table Cells](https://docs.textcontrol.com/tx-text-control-activex/document-editor/tables/formulas/llms-full.txt)
- **Next:** [Using Images](https://docs.textcontrol.com/tx-text-control-activex/document-editor/images/llms-full.txt)
