Excel’s grid-like appearance can seem static at times without the possibility of creating customized interfaces to match the needs of the data stored in a worksheet.

Although this is true to some extent, Microsoft has built into Excel the ability to instantly customize column widths and row heights to match the size of the data in the cells.

Learn how to use Excel’s AutoFit feature to automatically change the size of columns and rows to the size of the data in a worksheet.

Before You Change Column Widths and Row Heights in Excel

There are limits to how big and small you can make columns and rows in Excel. Column widths and row heights with a value of zero are hidden in an Excel worksheet. This is the equivalent to using the hide column or hide row feature.

Columns can have a maximum width of 255. This number represents the maximum number of characters a column can hold at the standard font size.

Changing the font, the font size, and adding other characteristics to the font such as italics and bolding greatly reduce the maximum number of characters a column can hold. The default size of an Excel column is 8.43, which correlates to 64 pixels.

Rows can have a maximum height of 409. This number represents the how many 1/72nds of an inch the row can hold. The default size of an Excel row is 15, which correlates to 20 pixels or about 1/5th of an inch.

Using Excel’s AutoFit Feature

Suppose in your Excel worksheet you have text in the A1 cell that extends beyond the 8.43 (64 pixels) default column width. Notice that although the column’s width cannot contain the length of the text, Excel allows the text to spill over into adjacent columns.

Select Column A, click on the Home tab on the Ribbon, and locate a section of the Ribbon almost all the way to the right labeled Cells.

Click on the button titled Format and locate a section of the menu labeled Cell Size. Notice that there are three options for changing the width of a column.

Column Width – This option lets you manually change the width of a column by typing in a number. This option isn’t useful because you can more easily accomplish the same thing by simply dragging the column to your desired size.

AutoFit Column Width – This is the option we want. This option will change the size of the column to a new size depending on the length of the contents of the cell in the column that takes up the most space.

Default Width – This option doesn’t actually change the width of any columns; it simply changes the default width of the columns for a particular worksheet.

On the Format button’s menu, select AutoFit Column Width and notice that the width of Column A has changed to contain the length of the text in the A1 cell.

Note that you can also autofit a column by simply selecting the column or columns and then double-clicking on the right-hand boundary of any selected column.

If you want to reset all column widths back to the default width, just select Format – Default Width and type in 8.43. You can also use a keyboard shortcut to autofit columns in Excel.

Just press ALT + H and then press O and then I. You can let go ALT and H once you have pressed them. So the full key combination is ALT + H + O + I.

Unlike column widths, Excel automatically adjusts the height of a row to accommodate the height of the text that takes up the most vertical space in each row.

Therefore, the AutoFit Row Height feature found on the Format button is not as useful as the AutoFit Column Width feature.

When pasting data into an Excel worksheet, there are times when the row heights do not adjust automatically. When this happens, text will be cut off rather than spill over into another row either above or below.

To fix this, select the row with the cut-off text and click on Format > AutoFit Row Height. This will force Excel to change the height of the row to accommodate the unusually tall text.

For rows, you can use a very similar keyboard shortcut of ALT + H + O + A to autofit row heights.

Using Excel’s AutoFit feature you can automatically change the width of columns and the height of rows in a worksheet to accommodate different sized text without having to manually change the width and height values.

A real time saver, the AutoFit feature can also make data in your worksheet easier to access and read. Enjoy!