View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
MyVeryOwnSelf[_2_] MyVeryOwnSelf[_2_] is offline
external usenet poster
 
Posts: 143
Default How do I center numbers in a cell, but align by decimal?

I would like to keep numbers near the center of a long cell, but align
the numbers by decimal. Is this possible?


There's probably a better way, but here's one that seems to work.

If there are at most three decimal places, use a helper column with this
formula:
=TEXT(A1,
IF(MOD(A1,1)=0,"#. ",
IF(MOD(10*A1,1)=0,"#.# ",
IF(MOD(100*A1,1)=0,"#.## ",
"#.###"))))
Use Courier font, or another having fixed-width characters.

For more or fewer decimal places, modify accordingly.

To adjust the horizontal placement in the cells, use
Format Cells Alignment Horizontal Left indent
and set the "indent" parameter to taste.

(I have Excel 2003.)