Cheatography
https://cheatography.com
Excel cell formatting codes
Number Format Codes
Number format codes are strings of symbols which define how Excel displays that data in your cells |
Each number format code is made up of up to 4 blocks, separated by a semicolon (;) |
Example |
Sect 1; Sect 2; Sect 3; Sect 4 |
These sections correspond to different types of data as shown below |
§ 1 |
§ 2 |
§ 3 |
§ 4 |
Positive values |
Negative values |
Zero |
Text |
The behavior for each section depends on how many sections are defined
Cell Section Format Behavior
Changing font color
You can change the color of the section by using a simple format code |
[Color Name] |
To use you simply set the color in the section you wish to color |
Example |
[Red]General;[Blue]General |
Complete list of color codes |
Black |
Green |
White |
Blue |
Magenta |
Yellow |
Cyan |
Red |
The General message just tell Excel to represent the number as entered by the user. Be careful when using this for negative numbers, as you only get the value!
Adding Text
You can add text around numbers is a section in two ways |
Single Characters |
For single characters simply type a backslash before the character |
Eg. \@General |
|
1234.567 |
@1234.567 |
|
-1234.567 |
-@1234.567 |
|
0 |
@0 |
|
Text |
Text |
Note: Text is not affected in this example |
Text Strings |
To add an entire string to a number surround the string in quotes (" ") |
Eg. General" units" |
|
1234.567 |
1234.567 units |
|
-1234.567 |
-1234.567 units |
|
0 |
0 units |
|
Text |
Text |
Note: Again, text is not affected by this format code (since that section is not explicitly listed) |
Eg. General" unit A";General" unit B";General" unit C";General" unit D" |
|
1234.567 |
1234.567 unit A |
|
-1234.567 |
1234.567 unit B |
|
0 |
0 unit C |
|
Text |
Text unit D |
Note that there is no representation of the the fact that the negative value is negative. Our definition of the negative section did not include one. |
Special Characters |
The following characters can be added to a format section without being escaped |
$ |
+- |
<=> |
() |
{} |
^ |
' |
: |
/ |
~ |
& |
! |
(space) |
|
|
Decimals places, Digits, and Commas
Symbol |
Description |
Summary |
0 |
Zero |
Forced Digit |
? |
Question Mark |
Aligned Digit |
# |
Pound Sign |
Un-Forced Digit |
. |
Period |
Decimal Point |
, |
Comma |
Thousands Separator |
* |
Asterisk |
Repeating Character |
_ |
Underscore |
Space Modifier |
Examples |
|
|
Zero (0) |
|
Format |
0.00 |
|
|
|
|
|
|
|
|
|
Question Mark (?) |
|
Format |
0.?? |
|
|
|
|
|
|
|
|
|
Pound Sign (#) |
|
Format |
#.## |
|
|
|
|
|
|
|
|
|
Period (.) |
The period in a number format code speifies the location of the decimal point |
Comma (,) |
|
Format |
$??,???.00 |
|
|
|
|
|
|
|
|
|
|
|
|
Asterisk (*) |
|
Format |
*=0.## |
|
|
|
|
|
|
|
|
|
Underscore (_) |
|
Format |
_(#.##_);(#.##) |
|
|
|
|
|
|
|
|
|
|
|
Fractions, Percentages, and Scientific Notation
Symbol |
Description |
Notation |
|
Forward Slash |
Fraction |
|
Percent Sign |
Percentage |
|
Exponential |
Scientific |
Fractions |
Fraction notation rounds values to the nearest possible fraction. Remember that fractions can be either proper, or improper. |
Examples |
|
|
Reduced Fractions |
|
Format |
# ???/??? |
|
|
|
|
|
|
|
|
|
|
|
|
|
Format |
# ??/?? |
|
|
|
Fixed Base Fractions |
It's possible to force Excel to use a specific denominator by specifying it in the format code |
|
Format |
# ##/15 |
|
|
|
|
|
|
|
|
|
Percentages (%) |
|
Format |
#% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can also specify fractional percentages |
|
Format |
# #/#% |
|
|
|
|
|
|
You can specify the number of digits with decimal places |
|
Format |
#.0% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Scientific Notation |
Excel uses E+
notation for exponential values. The format code in front of the E+
describes the relevant digits, and another format code on the other side of the E+
describes the handling of the exponent. |
|
Format |
#E+# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Format |
0.00E+00 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by nqramjets