Welcome to the Genome Toolbox! I am glad you navigated to the blog and hope you find the contents useful and insightful for your genomic needs. If you find any of the entries particularly helpful, be sure to click the +1 button on the bottom of the post and share with your colleagues. Your input is encouraged, so if you have comments or are aware of more efficient tools not included in a post, I would love to hear from you. Enjoy your time browsing through the Toolbox.

Thursday, January 23, 2014

Formatting Excel Cells with Zero Filling

While Microsoft Excel could use some improvements for data management and analysis, it remains my program of choice for putting together summary tables, particularly the descriptive statistics of most Table 1's.  I'm pretty particular with formatting and wanted to create a Table 1 with column percentages that all lined up nicely.  To do this I needed to zero fill numbers both before and after the decimal point so that each number, when formatted, took up the same amount of space in the column.  I the past I would do this by pasting the table as text (without formulas) and then manually filling in zeros.  This was tedious, especially when having to redo tables after sample numbers changed.

Today I found out there is a way to have Excel automatically include these zeros.  You can do this by creating a custom number format.  Here's how to do so.

1). Right click on the cell you want to format and choose Format Cells...
2). Click the Number tab and select Custom in the Category: list.
3). Put in your desired formatting.  You can do this by building off other format types.  In my case, I wanted to have a format so that the numbers 3.5562 and 55 appeared as (03.6) and (55.0), respectively.  To do this the Type: box needed to have the format (00.0).  This will zero fill both before and after the decimal point as well as round all numbers by one decimal place.

As you can imagine, you can customize this to zero fill based on your particular needs or desired format type.  Below is an example Table 1 excerpt to show how the formatting looks.


No comments:

Post a Comment