Forum Discussion
Excel Novice
A custom number format will do that. A good introduction can be found in ExcelJet's Excel custom number formats, or you can read Microsoft's Review guidelines for customizing a number format.
The basic form of Excel custom number formats can have up to four sections, separated by semicolons:
- format code for positive numbers
- format code for negative numbers
- format code for zeros
- format code for non-numbers (text)
If you omit the encoding for a section โ but retain the semicolons around it โ values corresponding to that section will not be displayed. E.g., to not display negative numbers, or to display them differently, you might use one of these custom formats (these work best with integer values; real numbers are rounded):
0;;0;@
0;"";0;@
0;"(neg)";0;@
0;"0";0;@
See the attached workbook. The built-in function TEXT used in formulas therein does much the same work as the Format Cell dialog*; that's useful for trying out custom or built-in formats without having to open and close the Format Cell dialog many times.
* - As the TEXT function generates a text value, its result does not follow the rules for aligning number values. I had to force right-alignment on the rows for number values.
BTW, a quick way (in Excel for Windows) of getting to the Format Cells dialog is to press Ctrl + 1. Select the cells you want to have a new/changed format before pressing that key combination.