By default, all the rows and columns in Excel are the same size, but sometimes you have to enter a long data, like an address or a phone number, etc. When you do that data exceeds the width of the cell, and it spills out to an adjacent cell/cells. 

In cases like this, you can use Excel’s AutoFit feature to automatically adjust the width or height of a cell to fit in with different-sized values without having to manually resize the cells. This article will explain how to autofit the columns and rows in Excel.

Autofitting Rows and Columns using Mouse Double-Click

Let’s assume you have a dataset as shown below where Company name in column B overflows to adjacent cells.

To autofit one column (B), just move your mouse cursor over the right edge of the column header until you can see the double-headed arrow icon, then double click the border.

Now, Excel will immediately adjust the column width to fit the largest value in that column.

To autofit one row (3), just position your cursor over the lower border of the row header. You would see that the cursor turns to a double-sided arrow and then double-click the border.

Excel will adjust the row height to accommodate your data. See the result below.

Autofit Multiple Rows and Columns

If you want to autofit multiple columns, first select all the columns that you want to be autofitted by selecting and dragging over the column headers. If you want to select multiple non-adjacent columns, click and hold CTRL the key while clicking the column headings. In this case, we need to autofit columns B and C.

Then, double click side the right border of one of the column headings.

As you can see both columns are now autofitted.

Autofitting rows are as same as autofitting columns. To autofit multiple rows, select all the rows that you want to be autofitted and double-click on the lower border of one of the row headers.

Autofitting Rows and Columns using Excel Ribbon

Another way to autofit rows and columns in Excel is by using the AutoFit option in the Excel ribbon.

To Autofit column, first, select all the columns that you need to autofit.

Next, head to the ‘Home’ tab and click on the ‘Format’ icon in the ‘Cells’ group. In the drop-down, select the ‘Autofit Column Width’ option.

You can also access the ‘Autofit Column Width’ option from the ‘Format’ menu using a keyboard shortcut. For that, select the column header that you want to autofit and press ‘Alt + H’, then press ‘O’, and then press ‘I’.

To Autofit rows, select one, several, or all rows on the sheet that needs to be autofitted. Next, go to the ‘Home’ tab and click on the ‘Format’ icon in the ‘Cells’ group. Then, select the ‘Autofit Row Height’ option.

To Autofit Row using keyboard shortcut keys, select the row header that you want to autofit and press ‘Alt + H’, then press ‘O’, and then press ‘A’.

That’s it. Now, AutoFit feature will save you a lot of time when it comes to resizing your columns and rows.