How to autofit a column in excel
Tutor 5 (120 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
Autofit is a command that automatically adjusts a column’s width so every cell in that column displays its content without truncation or extra empty space.
How do I autofit a single column?
To autofit a single column:
-
Select any cell in the column.
-
Move the mouse pointer to the right edge of the column header (the boundary between the column letters).
-
Double-click the boundary.
The column width will adjust to fit the longest cell in that column.
How do I autofit multiple columns at once?
To autofit multiple columns at once:
-
Select the columns you want to resize (click and drag across column headers or hold Shift and click the first and last headers).
-
Move the mouse pointer to the right edge of any selected column header.
-
Double-click the boundary.
Each selected column will resize to the longest entry in its own column.
How do I autofit using the Ribbon (menu)?
To autofit using the Ribbon:
-
Select the column(s).
-
Go to the Home tab.
-
Click Format in the Cells group.
-
Choose AutoFit Column Width.
This works the same for single columns and multiple selected columns.
What keyboard shortcuts perform Autofit?
To use keyboard shortcuts on Windows:
-
Select the column(s).
-
Press Alt, then H, then O, then I (press these sequentially, not simultaneously).
This triggers AutoFit Column Width.
Are there differences between Windows and Mac?
Differences between Windows and Mac:
-
Windows provides a built-in shortcut: Alt → H → O → I for autofitting columns.
-
Mac does not provide a reliable default keyboard shortcut for AutoFit.
-
Use the menu: Format → Column → AutoFit Selection.
-
Create a custom keyboard shortcut in System Preferences → Keyboard → Shortcuts → App Shortcuts by assigning a key combination to the exact menu name AutoFit Selection.
-
How do I fix columns that show #### instead of values?
To fix columns showing ####:
-
Select the column with ####.
-
Use a double-click on the column boundary or use Home → Format → AutoFit Column Width.
Numbers display as #### when the column is too narrow for the cell contents or for date/time formats.
How do I autofit when content is produced by formulas that change frequently?
To autofit columns after formulas update:
-
Select affected column(s).
-
Use the double-click boundary method or Home → Format → AutoFit Column Width.
For automatic adjustment on every change, use a small macro (see next section).
How do I autofit using VBA (macro)?
To autofit columns with VBA:
-
Press Alt + F11 to open the Visual Basic Editor on Windows. On Mac, open the VBA Editor from the Developer tab.
-
Insert a new module.
-
Paste the code below and run it.
Sub AutoFitAllColumns()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Cells.EntireColumn.AutoFit
Next ws
End Sub
How do I autofit only columns in a specific range?
To autofit only columns within a range:
-
Select the range (for example, select A1:D50).
-
Move to the header boundary of any column inside the range.
-
Double-click the boundary.
Only the columns that cover the selected range will be autofitted.
Troubleshooting: My autofit leaves extra space or cuts text. What causes that?
Common causes and fixes:
-
Presence of wrapped text changes how height and width behave. Use Wrap Text off to measure single-line widths.
-
Merged cells prevent reliable autofit. Unmerge cells before applying autofit, or set a manual width.
-
Custom fonts or different zoom levels may change visible width. Set a consistent zoom level and confirm font settings.
Best practices for clean spreadsheets
-
Use autofit to eliminate hidden truncated data before sharing a file.
-
Apply consistent column widths for tables that must align visually.
-
Avoid excessive manual resizing when working with large tables; use autofit selectively.
Where can I find the AutoFit commands in the Excel interface?
To find AutoFit in the interface:
-
Open the Home tab.
-
Look in the Cells group for Format.
-
Select AutoFit Column Width or AutoFit Row Height from that menu.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to track changes in excel
Answers · 1
How to lock certain cells in excel
Answers · 1
How to merge two excel spreadsheets
Answers · 1
Where is the name box in excel
Answers · 1