by Allen Wyatt
(last updated June 13, 2020)
David wonders if there is a way to format a column to display numbers as spaced pairs [xx xx xx.xx] but only display the decimal and trailing pair of a number if they exist? For instance, 123456 would display as 12 34 56 (no decimal point) and 123456.7 would display as 12 34 56.70. David cannot seem to figure this out using custom formats.
The only way to do this using custom formats is to create two custom formats. The two would look this way:
## ## ## #0 ## ## ## #0.00
This would allow up to 8 digits (10 digits if you have 2 to the right of the decimal point) to be displayed as spaced pairs. The problem is that you would need to look at your data and apply whichever format is appropriate for the data. The only way to make the application of the custom formats automatic, would be to also apply conditional formatting to the cells. Once the custom formats have been defined, apply the second one (the one that allows for digits to the right of the decimal point) to all of the cells. Then follow these steps:
Figure 1. The Conditional Formatting Rules Manager dialog box.
Figure 2. The New Formatting Rule dialog box.
Now your numbers should appear formatted just as you want them to appear.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13771) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
You may want Excel to format your dates using a pattern it doesn't normally useâ€"such as using periods instead of ...Discover More
When you create custom cell formats, you can include codes that allow you to set the color of a cell and that specify the ...Discover More
If you are familiar with decimal tabs in Word, you may wonder if you can set the same sort of alignment in Excel. The ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.