Excel Practice Test

โ–ถ

To AutoFit in Excel, select the columns or rows, then choose Home > Cells > Format > AutoFit Column Width (or AutoFit Row Height), or double-click the boundary next to the column or row heading. On Windows the keyboard version is Alt, H, O, I for columns and Alt, H, O, A for rows. Practice with the free Excel practice test on PracticeTestGeeks (500+ questions with answer explanations).

AutoFit tells Excel to size each column or row to its longest or tallest visible content, which fixes #### in number cells and clipped text. This guide covers every method, the Microsoft-documented size limits, why AutoFit sometimes does nothing (merged cells, wrap text, PivotTables), and a macro for one-click formatting across a workbook. Platform differences for Mac and Excel for the web are flagged along the way.

Free Excel Study Tools

Interactive Excel resources on PracticeTestGeeks, free to start:

AutoFit at a Glance

2
Clicks via ribbon Home > Format > AutoFit
Alt H O I
Keyboard shortcut for AutoFit Column Width
Alt H O A
Keyboard shortcut for AutoFit Row Height
8.43
Default Excel column width in characters

What AutoFit Actually Does

AutoFit measures the widest piece of content in a column (or the tallest item in a row) and snaps the boundary to match. It uses the font, font size, and cell formatting in effect when you run it. Change the font from Calibri 11 to Arial 14 later and the column may look cramped again until you re-run AutoFit.

One subtle point. AutoFit Column Width does not shrink a column to honor wrapped lines, so a long wrapped paragraph can leave the column far wider than you want. When a cell holds wrapped text, set the column width yourself first, then run AutoFit Row Height so the row grows to show every line.

Rows behave differently: AutoFit Row Height takes wrapped content into account. The order matters: set the column width first, then AutoFit the row height.

Click the Select All button (the triangle above row 1 and left of column A), then double-click the boundary between any two column headings. Microsoft documents this as the quickest way to AutoFit every column on the worksheet. Double-clicking the boundary below a row heading does the same for every row. On Windows, Ctrl + A selects the whole sheet only when the active cell is outside a data block; press it twice inside data.

The Ways to AutoFit Columns and Rows

You can AutoFit from the mouse, the ribbon, the keyboard, or VBA. Dragging or double-clicking is fastest when your hand is already on the mouse. The ribbon is friendliest for new users, keyboard Key Tips pay off when you AutoFit often, and VBA wins for repetitive reports.

The ribbon command lives under Home > Cells > Format. Under Cell Size you will see Row Height, AutoFit Row Height, Column Width, AutoFit Column Width, and Default Width. The right-click menu on a header offers Column Width or Row Height, but Microsoft does not list AutoFit there, so use the ribbon or the boundary double-click. You can add the Format command to the Quick Access Toolbar if you use it constantly.

AutoFit Methods Compared

MethodStepsWhere it appliesNotes
Double-click column boundarySelect the column(s), then double-click the boundary to the right of a selected column headingMicrosoft 365, 2024, 2021, 2019, 2016 (Windows article)Fits the widest visible value; with Select All it fits every column
Double-click row boundarySelect the row(s), then double-click the boundary below a row headingSame as aboveFits the tallest content in the row
Ribbon: AutoFit Column WidthSelect columns, Home > Cells > Format > Cell Size > AutoFit Column WidthSame as aboveColumn width range is 0 to 255 characters; default 8.43
Ribbon: AutoFit Row HeightSelect rows, Home > Cells > Format > Cell Size > AutoFit Row HeightSame as aboveRow height range is 0 to 409 points; default 15.00
Select All + double-clickClick Select All, then double-click any column (or row) boundarySame as aboveMicrosoft's documented shortcut for the whole worksheet
Keyboard Key TipsAlt, H, O, I (column width); Alt, H, O, A (row height); press keys one after anotherWindows only; the Alt Key Tips do not exist on MacLetters follow the ribbon path Home > Format; the on-screen Key Tips confirm them
VBACells.EntireColumn.AutoFit and Cells.EntireRow.AutoFitDesktop Excel with macros enabled; macros do not run in Excel for the webSave as .xlsm; see the macro section below

Merged cells are the main exception: AutoFit does not use merged cells to calculate width or height.

Method Cheat Sheet

๐Ÿ”ด Double-Click Boundary

Hover the right edge of a column header until the cursor becomes a double arrow, then double-click. Instantly AutoFits that column.

๐ŸŸ  Ribbon Path

Home > Cells > Format > Cell Size > AutoFit Column Width (or AutoFit Row Height). Works on whatever columns or rows are currently selected.

๐ŸŸก Keyboard Shortcut

Windows: Alt, H, O, I for column width and Alt, H, O, A for row height. Press the keys one after another, not together.

๐ŸŸข Select-All + Double-Click

Click Select All, then double-click any column boundary. Microsoft documents this as the way to AutoFit every column on the worksheet.

๐Ÿ”ต VBA Macro

Cells.EntireColumn.AutoFit and Cells.EntireRow.AutoFit. Attach to a button or run on workbook open.

Step-by-Step: AutoFit Column Width

Open the worksheet. Click a column letter to select one column, or drag across several headings. To select every column, click the Select All triangle above row 1 and left of column A.

Go to the Home tab, open Format in the Cells group, and under Cell Size choose AutoFit Column Width. Excel resizes each selected column to its longest visible value.

Prefer the keyboard on Windows? Press Alt, then H, then O, then I, one key at a time. The Key Tip letters appear on the ribbon as you go, which helps if you forget the sequence.

For the mouse, select the column and double-click the boundary to the right of its heading. The cursor turns into a double-headed arrow, and the column snaps to the width of its widest value. Select All first to do every column at once.

AutoFit by Excel Version

๐Ÿ“‹ Excel 365 / 2021

Home > Format > AutoFit Column Width. On Windows the Key Tip sequence Alt, H, O, I follows the same path. You can also press Alt + Q and type AutoFit to find the command.

๐Ÿ“‹ Excel 2016 / 2019

Microsoft's column-width article lists Excel 2016 and 2019 as using the same Home > Cells > Format > AutoFit Column Width steps and the same boundary double-click.

๐Ÿ“‹ Excel for Mac

The Alt-key sequences are Windows Key Tips and do not apply on macOS. Select the columns and double-click the boundary to the right of a heading, or use the Format commands in Excel; Microsoft documents Mac steps in a separate "Change the column width or row height (Mac)" article.

๐Ÿ“‹ Excel Web

Microsoft documents Excel for the web in a separate "Change the column width or row height (web)" article, so check it for the exact menu. VBA macros do not run in the browser, so use the desktop app for macro-based AutoFit.

Step-by-Step: AutoFit Row Height

Row AutoFit is the partner to column AutoFit and matters most when Wrap Text is on. Select the row numbers, then go to Home > Cells > Format and, under Cell Size, choose AutoFit Row Height. Excel grows or shrinks each selected row to its tallest content.

On Windows the keyboard route is Alt, H, O, A. The double-click trick also works: double-click the boundary below a row heading. Select All first to AutoFit every row at once.

Running AutoFit Row Height on a row you previously dragged to a custom height puts the row back under automatic sizing. If the row still shows one line, check that Wrap Text is on (Home > Wrap Text), and that the cell is not part of a merged range, which AutoFit ignores.

AutoFit with VBA: The One-Click Macro

If you build the same report every week, manual AutoFit gets old. A two-line macro fixes that forever. Press Alt + F11 to open the Visual Basic Editor. Insert a new module via Insert > Module. Paste the following:

Sub AutoFitEverything()
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit
End Sub

Close the editor. Press Alt + F8, select AutoFitEverything, click Run. Every column and row in the active sheet snaps to fit. Save the workbook as .xlsm to keep the macro. For a button, go to the Developer tab, click Insert, choose a Form Control button, draw it on the sheet, and assign the macro. One click and the entire sheet is formatted.

Want it across every sheet in a workbook? Wrap the macro in a loop:

Sub AutoFitAllSheets()
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
        ws.Cells.EntireColumn.AutoFit
        ws.Cells.EntireRow.AutoFit
    Next ws
End Sub

This iterates every worksheet in the file. Perfect for a workbook with a tab for each month or region. Combine with the Workbook_BeforeSave event in ThisWorkbook to AutoFit automatically every time the file saves. Just remember that the macro skips hidden sheets only if you add an If ws.Visible Then check, otherwise it touches them too.

AutoFit Pre-Flight Checklist

Selection covers the columns or rows you want to resize
Wrap Text is set the way you want before running row AutoFit
Merged cells are unmerged or replaced with Center Across Selection
Font and font size are final before running AutoFit
No cell content longer than the 255-character column limit needs Wrap Text instead
Test Your Excel Skills

Common AutoFit Problems and Fixes

AutoFit interacts with wrap, merges, PivotTables, and query-loaded tables in ways that can trip new users. These are the issues that come up most and the fix for each.

Column will not resize past a certain width

Excel caps column width at 255 characters (Microsoft's documented maximum). If one cell holds a 300-character paragraph, AutoFit hits that ceiling. Turn on Wrap Text for the cell, set a sensible width, then AutoFit Row Height to see all of it. If strings are consistently long, split them with Text to Columns.

AutoFit Row Height shows only one line

Either Wrap Text is off, or the cell is part of a merged range. Turn on Home > Wrap Text, unmerge if needed, then run Home > Format > AutoFit Row Height again. Row height is capped at 409 points, so extremely long wrapped text will still be cut off.

Column widths change after a table refreshes

A table loaded from a query or external data can re-size columns when it refreshes. Run AutoFit again after the refresh, or run the macro below at the end of your refresh routine.

PivotTable widths reset on refresh

Right-click anywhere in the PivotTable, choose PivotTable Options, and on the Layout & Format tab uncheck Autofit column widths on update. Your widths then stay put after a refresh.

AutoFit Pros and Cons

Pros

  • Saves manual column dragging on big datasets
  • Works from the mouse, ribbon, keyboard, or VBA
  • Plays nicely with macros for repeat formatting jobs
  • Built in; no add-in required

Cons

  • Ignores merged cells, leaving headers truncated
  • Column width is capped at 255 characters
  • Can disturb carefully designed templates if run carelessly
  • PivotTable refresh can override AutoFit results
  • Wrapped text and AutoFit Column Width interact in confusing ways

When to Use AutoFit vs Manual Widths

AutoFit is brilliant for working sheets, exploratory analysis, and any spreadsheet you build once and discard. The moment you start sharing files with non-technical users, the calculus changes. A column that AutoFits to fit the longest cell will move every time the underlying data changes. That can break printed layouts, mess with dashboards, and surprise readers who expect stable column widths.

For a polished dashboard or template, set widths manually after you AutoFit once. Round each column to a sensible round number (12, 15, 20 characters) and lock the column widths so Excel does not adjust them on refresh. PivotTables have an explicit setting for this, as we saw. For regular ranges, just resist the urge to run AutoFit on a finished design. A good rule: AutoFit early, lock late.

On the other hand, never hand-tune widths for an exported CSV report or an internal QA sheet. AutoFit it and move on. The five seconds you save compound across the year.

AutoFit and Print Layout

One small gotcha: On-screen column widths can differ slightly from what prints. After AutoFit, switch to Page Layout view (View > Page Layout) and check the columns are not cutting off the last character of any cell. If they are, nudge the column boundary one notch wider, or set the print scaling to Fit All Columns on One Page via Page Layout > Scale to Fit.

Query-Loaded Data and AutoFit

If data lands in an Excel Table through Power Query or an external connection, column widths can change when the query refreshes. Re-run AutoFit after the refresh, or call the AutoFit macro from your refresh routine so every refresh ends with clean widths.

Sample Excel Practice Questions

Try these questions from our free Excel practice tests. The correct answer and an explanation follow each question.

  1. Which one of the aforementioned Excel capabilities enables you to select/highlight every cell that contains a formula?

    • A. Replace
    • B. Find
    • C. Go To Special
    • D. Go To

    Answer: C. Go To Special

    The 'Go To Special' feature in Excel (accessible via F5 or Ctrl+G, then 'Special...') provides advanced selection options, including the ability to highlight every cell that contains a formula. This is invaluable for auditing spreadsheets, understanding data dependencies, and quickly identifying all calculated values within a worksheet.

  2. A developer is recording a macro that needs to perform a series of formatting steps starting from any active cell. To ensure the macro's actions are recorded based on their position relative to the starting cell (e.g., move one cell right), which setting must be enabled before performing the actions?

    • A. Enable All Macros in Trust Center
    • B. The Personal Macro Workbook
    • C. Stop Recording
    • D. Use Relative References

    Answer: D. Use Relative References

    By default, Excel records macros with absolute references (e.g., Range("C5").Select). Enabling 'Use Relative References' records actions based on their offset from the active cell, allowing the macro to be run from any starting point on the worksheet with the same relative effect.

  3. What happens when you enter a formula that creates a circular reference in Excel?

    • A. Excel deletes the formula automatically
    • B. Excel returns zero by default
    • C. Excel displays a warning and may return 0 or an error
    • D. Excel solves it using Goal Seek

    Answer: C. Excel displays a warning and may return 0 or an error

    By default Excel warns the user about circular references and typically shows 0 unless iterative calculation is enabled.

  4. You have an Excel table named 'SalesData' with columns for '[Units]' and '[Unit_Price]'. You want to add a new calculated column named '[Revenue]' that multiplies the units by the unit price for each row. Which formula, when entered into the first cell of the new column, will correctly and automatically populate for all other rows in the table?

    • A. =B2*C2
    • B. =[@[Units]]*[@[Unit_Price]]
    • C. =SalesData[Units]*SalesData[Unit_Price]
    • D. =PRODUCT([Units],[Unit_Price])

    Answer: B. =[@[Units]]*[@[Unit_Price]]

    In an Excel table, using `[@ColumnName]` creates a structured reference that refers to the value in the specified column for the current row. This syntax allows Excel to automatically fill the formula down the entire column, creating a calculated column.

Take the full Excel practice test

Many readers pair this guide with the excel latest version to check their readiness before exam day.

Excel Questions and Answers

What is the keyboard shortcut to AutoFit columns in Excel?

On Windows, press Alt, then H, then O, then I, one key after another, to AutoFit the selected columns. For row height, press Alt, H, O, A. These are ribbon Key Tips for Home > Format > AutoFit, and the Alt sequences do not exist on Mac, where you should double-click the column boundary instead.

How do I AutoFit all columns in Excel at once?

Click the Select All triangle above row 1 and left of column A, then double-click the boundary between any two column headings. Excel resizes every column to its widest value. Alternatively, with all columns selected, choose Home > Format > AutoFit Column Width. Microsoft documents the boundary double-click as the quickest way to AutoFit the whole worksheet.

Why is AutoFit not working in Excel?

The usual cause is merged cells, because AutoFit ignores them when calculating width and height. Other causes are Wrap Text being off, so rows stay one line, or text longer than the 255-character column limit. Unmerge the cells, turn on Wrap Text, and re-run Home > Format > AutoFit Row Height or Column Width.

Does AutoFit work on merged cells?

No. AutoFit does not size columns or rows from merged cells, so a merged header often looks truncated. The workaround is to unmerge, AutoFit using the underlying data, then apply Center Across Selection through Format Cells > Alignment > Horizontal. That keeps the centered look without blocking AutoFit on that range.

How do I AutoFit row height for wrapped text?

Turn on Wrap Text (Home > Wrap Text), set the column to the width you want, then select the rows and choose Home > Format > AutoFit Row Height, or double-click the boundary below the row heading. Set the width first, because AutoFit Column Width will not shrink a column to honor wrapped lines.

What is the maximum column width and row height in Excel?

Microsoft documents a maximum column width of 255 characters and a maximum row height of 409 points. The minimum for both is 0, which hides the column or row. The default column width is 8.43 characters and the default row height is 15 points, so AutoFit can never exceed those maximums.

Why does my PivotTable column width reset after refresh?

By default, a PivotTable re-fits its columns whenever it updates. Right-click a cell in the PivotTable, choose PivotTable Options, open the Layout & Format tab, and uncheck Autofit column widths on update. Your manual or AutoFit widths then persist through refreshes of the underlying data. Without that change, Excel re-fits every column each time the PivotTable updates.

How do I AutoFit every sheet in a workbook with VBA?

Press Alt + F11, insert a module, and paste a loop that goes through ThisWorkbook.Worksheets and calls ws.Cells.EntireColumn.AutoFit and ws.Cells.EntireRow.AutoFit for each sheet. Save the file as .xlsm and run the macro with Alt + F8. Macros do not run in Excel for the web, so use the desktop app.
Try an Excel Practice Test

Wrapping Up

AutoFit is one of those features you only notice when it is missing. Learn the ribbon path (Home > Format > AutoFit), the boundary double-click, and the Windows Key Tip sequences, and pick whichever is fastest at the moment.

Treat AutoFit as a starting point, not a final layout. Run it to clean up imported data, then set manual widths for anything you share or print. Lock down PivotTable widths so they survive refresh, and use Center Across Selection instead of merges to avoid the AutoFit-merge clash.

If you re-format the same sheets every week, record or paste the AutoFit macro and store it in your Personal Macro Workbook (PERSONAL.XLSB) so it is available in every file you open.

โ–ถ Start Quiz