To autofit a column or row in Excel, double-click the boundary line between the column letters (e.g., between A and B) or row numbers (e.g., between 1 and 2) at the top or side of the sheet. This instantly adjusts the cell size to fit the longest piece of data in that selection. Autofitting is the fastest way to eliminate the "#####" error (which occurs when a column is too narrow to display a number) and ensures that your text is not cut off, making your data professional and readable without the need for manual dragging.

What You'll Need

  • A computer with Microsoft Excel installed (Windows or macOS) or access to Excel for the Web.
  • A spreadsheet containing data that is either too long for the current cell width or contains excessive empty space.
  • A mouse or trackpad for the double-click method, or a keyboard for the ribbon-based method.

Step-by-Step

Method 1: The Double-Click Shortcut (Fastest)

  1. Open your Excel workbook and navigate to the worksheet containing the data you want to adjust.
  2. Move your mouse cursor to the top header row where the column letters (A, B, C, etc.) are located.
  3. Position the cursor exactly on the vertical line that separates the column you want to fix from the one to its right. For example, if column B is too narrow, hover over the line between B and C.
  4. The cursor will change from a thick white cross to a black double-sided arrow pointing left and right.
  5. Double-click the left mouse button. Excel will immediately snap the column width to fit the longest string of text or the largest number in that specific column.
  6. To do this for rows, move the cursor to the row numbers on the far left. Hover over the horizontal line between two row numbers until the cursor becomes a double-sided arrow pointing up and down, then double-click.

Method 2: Autofitting Multiple Columns at Once

  1. Click and hold the column letter of the first column you wish to adjust.
  2. Drag your mouse across to the right to highlight all the columns you want to autofit. Alternatively, click the first column letter, hold the Shift key, and click the last column letter in the range.
  3. Once the columns are highlighted, hover your cursor over any of the boundary lines between the selected column letters.
  4. Double-click that boundary line. Excel will apply the autofit logic to every selected column individually, adjusting each one to its own unique longest content piece.

Method 3: Autofitting the Entire Worksheet

  1. Click the "Select All" button, which is the small triangle located in the top-left corner of the grid, where the row numbers and column letters meet. You can also press Ctrl + A (Windows) or Cmd + A (Mac) on your keyboard.
  2. With the entire sheet selected, move your cursor to any boundary line between two column letters.
  3. Double-click the boundary. Every column in the entire workbook page will now be perfectly sized to its content.
  4. Repeat the process by double-clicking any boundary between two row numbers to autofit every row in the sheet.

Method 4: Using the Ribbon Menu (Formal Method)

  1. Select the cells, columns, or rows you wish to adjust.
  2. Go to the Home tab on the top ribbon.
  3. Locate the Cells group (usually toward the right side of the ribbon).
  4. Click on the Format button. Note that menu labels can differ slightly depending on your version of Excel or screen resolution.
  5. Under the "Cell Size" section of the dropdown menu, click AutoFit Column Width.
  6. If you need to adjust the height, click Format again and select AutoFit Row Height.

Common Mistakes

One of the most frequent mistakes users make is attempting to double-click inside the cell rather than on the boundary line of the header. Double-clicking inside a cell usually enters edit mode or selects a word, but it will never trigger the autofit function. You must be in the grey header area where the letters and numbers reside.

Another common error is selecting a range of cells and expecting the Ribbon's "AutoFit Column Width" to work without selecting the entire column. While it often works for the active selection, the most reliable way to ensure the entire column is adjusted is to click the column letter at the top to highlight the whole vertical strip before applying the format change.

Users also frequently confuse "Wrap Text" with "AutoFit." Wrap Text forces the text to move to a new line within the same cell, increasing the row height. AutoFit expands the width of the cell to keep the text on one single line. If you have Wrap Text turned on, AutoFit Column Width may not behave as expected because Excel assumes you want the text to stack vertically rather than stretch horizontally.

Tips

If you are working with a very large dataset, using the "Select All" triangle is significantly faster than dragging across columns. This ensures that no hidden columns are left with awkward widths that might mess up your printing layout later.

For those who prefer keyboard shortcuts, you can use a sequence of keys to autofit. On Windows, press Alt, then H, then O, then I. This sequence triggers Home > Format > AutoFit Column Width. While it takes a moment to learn, it is faster than moving the mouse for power users.

When preparing a sheet for a PDF or printout, always autofit your columns first, then check the "Page Layout" view. If autofitting makes a column so wide that it pushes the data onto a second page, you may need to disable AutoFit for that specific column and use "Wrap Text" instead to keep the document on one page.

If you have cells with formulas that result in long strings of text, be aware that AutoFit will adjust the column based on the result of the formula, not the formula itself. If the result changes later (e.g., a VLOOKUP pulls in a longer name), you will need to perform the AutoFit action again to accommodate the new data.

Troubleshooting

The column won't resize or the double-click isn't working: First, check if the worksheet is protected. If a sheet is locked or protected via the Review tab, you cannot change column widths or row heights. You will need to go to Review > Unprotect Sheet (and enter the password if required) before you can autofit.

The "#####" symbols are still there: This usually happens if the column is still too narrow or if the cell is formatted as a Date or Time and the value is negative (which Excel cannot display). Ensure you are double-clicking the boundary of the column letter, not the cell border. If the symbols persist, try widening the column manually by dragging the boundary to the right to see if the number appears.

AutoFit makes the column way too wide: This occurs when a single cell in that column contains an unusually long string of text (like a long URL or a detailed note). Because AutoFit looks for the longest entry, one outlier can ruin the layout. In this case, do not use AutoFit. Instead, set a manual width and enable "Wrap Text" for that specific column so the long text stacks vertically.

Merged cells are preventing AutoFit: AutoFit does not work reliably on merged cells. If you have merged cells across multiple columns, Excel cannot determine which column's width should be adjusted to fit the content. To fix this, unmerge the cells, autofit the columns, and then consider using "Center Across Selection" (found in Format Cells > Alignment) as a cleaner alternative to merging.

Frequently Asked Questions

Can I autofit rows and columns at the same time?

Yes. Click the "Select All" triangle in the top-left corner, then double-click any column boundary to autofit all columns, followed by double-clicking any row boundary to autofit all rows.

Does autofit change the actual value of my data?

No. Autofit only changes the visual dimensions of the cell (the width or height). It has no effect on the data, formulas, or formatting within the cell.

Why does my column width change back after I save?

Excel does not "reset" widths on save. However, if you are using a Table (Ctrl+T) with specific styles or if you have a Macro running in the background, the script may be resetting the column widths to a default setting every time the sheet calculates.

Is there a way to set a maximum width while still using autofit?

No, the built-in AutoFit feature has no "maximum" setting; it will expand as far as necessary to fit the text. To limit width, you must manually drag the column boundary or use Wrap Text.

Does AutoFit work in Excel for the Web?

Yes, the double-click method on the column/row headers works exactly the same in the web browser version as it does in the desktop application.