Comprendre les codes de formatage des nombres (Microsoft Excel)
Les codes de formatage les plus fréquemment utilisés sont ceux qui affectent les nombres simples. Excel en fournit plusieurs, comme indiqué ici:
Symbol |
Meaning |
|
General |
Uses the general display format. |
|
# |
Indicates a single-digit position. The digit is only displayed if there is a digit in that position. |
|
0 |
Indicates a single-digit position. If there is no digit in the position, a 0 is displayed. |
|
? |
Same as the 0 symbol, except results in a space being displayed for insignificant 0s on either side of the decimal point. |
|
. (period) |
The decimal point. |
|
% |
Percentage. The number is multiplied by 100 (for the display) and the % sign is added. |
|
, (comma) |
Thousands separator (if surrounded by digit place holders) or a thousands scalar (if the comma follows all the place holders). |
|
E- E+ e- e+ |
Displays in scientific format. |
|
$ – + / ( ) : space |
Displays that character |
|
\ |
Forces display of the following character |
|
* |
Repeats the next character to fill out the column width. |
|
_ (underscore) |
Leaves a space the width of the following character. |
|
« text » |
Displays the text within the quotes. |
|
@ |
Text place holder. |
Pour mieux comprendre ce que font ces codes, jetez un œil aux informations du tableau suivant, qui montre plusieurs formats courants et comment ils affectent les nombres.
Category |
Format |
Value |
Displayed As |
|||
Number |
,#0.00 |
.01 |
0.01 |
|||
.1 |
0.10 |
|||||
1234 |
1,234.00 |
|||||
-5678 |
-5,678.00 |
|||||
Percentage |
0.00% |
.01 |
1.00% |
|||
.1 |
10.00% |
|||||
1.234 |
123.40% |
|||||
-5.678 |
-567.80% |
|||||
Scientific |
0.00E+00 |
.01 |
1.00E-02 |
|||
.1 |
1.00E-01 |
|||||
1234 |
1.23E+03 |
|||||
-5678 |
-5.68E+03 |
|||||
Currency |
$,0.00_);[Red]($,0.00) |
.01 |
$0.01 |
|||
.1 |
$0.10 |
|||||
1234 |
$1,234.00 |
|||||
-5678 |
($5,678.00) |
Quel que soit le format utilisé pour afficher les nombres, la précision réelle du nombre n’est pas affectée. Ainsi, si un nombre est affiché en utilisant deux décimales, il est toujours conservé en interne à 15 décimales.
Tous les calculs sont effectués en utilisant la représentation interne plus précise.
ExcelTips est votre source de formation Microsoft Excel rentable.
Cette astuce (1939) s’applique à Microsoft Excel 97, 2000, 2002 et 2003.