Format a value according to the standard Excel behavior. This "standard" is not explicitly documented by Microsoft, so the behavior is determined by experimentation; see the tests.
An Excel format has up to four parts, separated by semicolons. Each part specifies what to do with particular kinds of values, depending on the number of parts given:
- One part (example: [Green]#.##)
- If the value is a number, display according to this one part (example: green text, with up to two decimal points). If the value is text, display it as is.
- Two parts (example: [Green]#.##;[Red]#.##)
- If the value is a positive number or zero, display according to the first part (example: green text, with up to two decimal points); if it is a negative number, display according to the second part (example: red text, with up to two decimal points). If the value is text, display it as is.
- Three parts (example: [Green]#.##;[Black]#.##;[Red]#.##)
- If the value is a positive number, display according to the first part (example: green text, with up to two decimal points); if it is zero, display according to the second part (example: black text, with up to two decimal points); if it is a negative number, display according to the third part (example: red text, with up to two decimal points). If the value is text, display it as is.
- Four parts (example: [Green]#.##;[Black]#.##;[Red]#.##;[@])
- If the value is a positive number, display according to the first part (example: green text, with up to two decimal points); if it is zero, display according to the second part (example: black text, with up to two decimal points); if it is a negative number, display according to the third part (example: red text, with up to two decimal points). If the value is text, display according to the fourth part (example: text in the cell's usual color, with the text value surround by brackets).
In addition to these, there is a general format that is used when no format is specified. This formatting is presented by the {@link #GENERAL_FORMAT}object.
@author Ken Arnold, Industrious Media LLC