Displaying Numbers as Spaced Pairs

Written by Allen Wyatt (last updated June 19, 2024)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


4

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:

  1. Select all the cells you want to format.
  2. Make sure the Home tab of the ribbon is displayed.
  3. Click the Conditional Formatting option in the Styles group. On the resulting submenu, click Manage Rules. Excel displays the Conditional Formatting Rules Manager dialog box. (See Figure 1.)
  4. Figure 1. The Conditional Formatting Rules Manager dialog box.

  5. Click the New Rule button. Excel displays the New Formatting Rule dialog box.
  6. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula to Determine Which Cells to Format. (See Figure 2.)
  7. Figure 2. The New Formatting Rule dialog box.

  8. In the Format Values Where This Formula Is True box, enter "=IF(A1=INT(A1),TRUE,FALSE)" (without the quote marks). The cell reference in this formula, of course, will vary depending on your data.
  9. Click the Format button. Excel displays the Format Cells dialog box.
  10. Using the Color drop-down list, choose the color red.
  11. Click OK to close the Format Cells dialog box.
  12. Display the Number tab of the ribbon.
  13. At the left side of the dialog box, choose Custom.
  14. In the custom formats available, choose from the custom formats you created the one that does not include anything to the right of the decimal point.
  15. Click on OK to accept your formatting and to close the Format Cells dialog box.
  16. Click OK. The Conditional Formatting Rules Manager dialog box reappears with your newly defined condition in it.
  17. Click OK to close the Conditional Formatting Rules Manager 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 Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Professional Looking Fractions

Professional typesetting has, in many ways, spoiled us. One way this is evident is in the preference we show for making ...

Discover More

Controlling Display of Page Breaks

Do you want page breaks displayed on the screen? Excel allows you to specify whether it should show those page breaks or not.

Discover More

Moving Macros from the Personal Workbook

Need to move a macro out of your Personal.xlsb workbook and into a regular workbook? You can do it using familiar editing ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Handling Negative Numbers in a Complex Custom Format

Custom formats are great for defining how a specific value in a cell should look. They aren't that great at doing complex ...

Discover More

Getting Rid of Leading Zeros in a Number Format

Excel, by default, displays numbers with a leading zero, if they are less than 1. Here's how you can get rid of those ...

Discover More

Easy Value Hiding

Want a quick and easy way to hide the information in a cell? You can do it with a simple three-character custom format.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2024-06-19 10:58:08

Hans-Georg Lindic

Hi Allen,
=(INT(A1)=1) will also do the Job.

Best regards
Georg


2024-06-19 05:40:28

Brian

Surely the formula "=A1=INT(A1)" does the exactly same as "=IF(A1=INT(A1),TRUE,FALSE)" - or have I lost the plot?


2020-06-15 13:17:08

Dave

If you're willing to accept always having a decimal point, this format would work well:
  "## ## ## #0.??"

That would get you results like "12 34 56." "12 34 56.7" and 12 34 56.78"

This isn't quite what was asked for, but it may be good enough.

Separately, I might suggest tweaking Allen's formats for conditional formatting to:
"## ## ## #0.00" and "## ## ## #0_._0_0"

This would keep all the digits within the column lined up, and it helps visually differentiate between the numbers with decimals and those without.


2020-06-14 06:58:53

Yokeboon

Use custom format

00 00 00 00 00.00


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.