Fixing “There isn’t enough memory to complete this action” in large datasets.

The error “There isn’t enough memory to complete this action” occurs when Microsoft Excel exhausts its allocated addressable memory pool while trying to process, sort, copy, or calculate data. In large datasets, this rarely means your computer is physically out of RAM. Instead, it indicates that Excel has hit internal architecture barriers, virtual address limits, or runaway overhead from phantom cell ranges and bloated metadata.

Quick Answer

Switch Excel calculation to Manual under Formulas > Calculation Options, press Ctrl + End on each worksheet to identify and delete “ghost rows” beyond your actual data, save as an Excel Binary Workbook (.xlsb), and restart Excel. If you run 32-bit Excel, upgrade to 64-bit to remove the hard 2 GB–4 GB memory ceiling.


Step 1: Diagnose Architecture Limits (32-Bit vs. 64-Bit)

Before modifying your dataset, verify your Excel bitness:

  1. Open Excel and navigate to File > Account.
  2. Click About Excel.
  3. Check the top line of the dialog for 32-bit or 64-bit.

If you are running a 32-bit installation on a machine with 16 GB or 32 GB of physical RAM, Excel cannot use more than 2 GB (or up to 4 GB with Large Address Aware updates) of virtual address space. When a sorting, filtering, or array formula demands a contiguous block of RAM that exceeds this allocation, Excel throws the out-of-memory error immediately.

Upgrading to 64-bit Office removes this process-level cap and links Excel’s ceiling directly to your system’s physical memory and Windows paging file limits. For a deeper technical breakdown of address boundaries, see “Excel ran out of resources while attempting to calculate”: Understanding 2GB vs. Large Address Aware limits.


Step 2: Reset the “Used Range” (Eliminate Ghost Rows)

The single most frequent operational cause of this error in large datasets is an inflated used range. Excel tracks every cell that has ever had formatting, a cleared space, or an adjusted border applied to it.

  1. Go to your active sheet and press Ctrl + End.
  2. Observe where the active cell lands:
    • If your data ends at row 50,000, column Z, but Ctrl + End takes you to row 1,048,576 or column XFD, Excel is treating millions of empty cells as active data in RAM.
  3. To clear the excess range:
    • Select the first empty row below your actual data.
    • Press Ctrl + Shift + Down Arrow to highlight down to row 1,048,576.
    • Right-click and select Delete (do not simply press Delete or Backspace, as that only clears cell content without resetting metadata).
    • Repeat the same process for empty columns using Ctrl + Shift + Right Arrow.
  4. Immediately save the workbook (Ctrl + S). The used range will not update in memory until the file is written to disk.

If excess cell styles or residual formatting refuse to clear, review Troubleshooting lag caused by “Too many different cell formats”.


Step 3: Stop Calculation Thrashing During Edits

When working with hundreds of thousands of rows, actions like pasting, filling down, or deleting columns force Excel to rebuild dependency trees across the entire workbook. This calculation overhead often exhausts temporary memory buffers.

  1. Go to Formulas > Calculation Options and set it to Manual.
  2. Uncheck Recalculate workbook before saving under File > Options > Formulas.
  3. Execute your bulk operations (copying, filling, sorting).
  4. Press F9 to recalculate once your structural edits are finished.

For automated models where calculation freezes persist during routine entry, consult Why “Automatic Calculation” mode is crashing your computer (and how to switch to Manual).


Step 4: Audit Volatile Formulas and Full-Column References

Standard lookup and aggregation formulas scale linearly, but volatile functions and open-ended array calls scale exponentially in memory consumption.

  • Avoid Full-Column References in Array Functions: Formulas such as =COUNTIF(A:A, ">0") or =SUMPRODUCT((A:A=1)*(B:B=2)) force Excel to scan and allocate tracking arrays for 1,048,576 rows. Constrain references to explicit ranges (e.g., $A$2:$A$150000) or convert your raw data into an official Excel Table (Ctrl + T) to utilize structured references (Table1[Amount]).
  • Replace Volatile Operators: Functions like OFFSET and INDIRECT trigger recalculations whenever any cell changes, preventing Excel from releasing memory buffers. Transition these formulas to non-volatile dynamic references using INDEX. See The Volatile Function Bloat: How INDIRECT and OFFSET kill system performance.

Step 5: Check for Invisible Drawing Objects

Hidden shapes, form controls, and invisible blank text boxes often multiply when importing data from enterprise resource planning (ERP) systems or copy-pasting tables from web portals:

  1. Press F5, click Special…, select Objects, and click OK.
  2. If Excel highlights hundreds or thousands of tiny bounding boxes across empty space, press the Delete key.
  3. Save and close the file.

A buildup of legacy vector graphics will bloat file sizes and consume calculation memory invisibly. For comprehensive removal procedures, review Fixing crashes caused by “Objects” (Hidden shapes and text boxes) piling up.


Step 6: Convert to Excel Binary Workbook (.xlsb)

Standard .xlsx and .xlsm files are compressed XML archives. When opened, Excel must decompress and parse raw XML text into memory objects. For large datasets, this parsing creates massive memory spikes.

  1. Navigate to File > Save As.
  2. Select Excel Binary Workbook (*.xlsb) from the file type dropdown.
  3. Close Excel completely, then reopen the .xlsb file.

Binary workbooks load directly into memory without XML parsing overhead, cutting file sizes by 30% to 70% and drastically reducing runtime heap pressure.


When to Move Beyond the Spreadsheet Grid

If your dataset requires more than 500,000 rows across multiple lookup tables, raw worksheet formulas will continue to push Excel toward memory failure. Load the raw tables directly into the Excel Data Model (Power Pivot) instead of standard sheets:

  • Power Pivot uses the VertiPaq engine, which compresses relational data in memory using column-based storage rather than row-based grid objects.
  • This allows Excel to process tens of millions of rows using a fraction of the RAM required by traditional worksheet formulas.