How to Fix Excel Insufficient Memory Errors When Sorting or Deleting Rows
Question details
Excel displays an 'insufficient memory' error when attempting to sort data or delete rows, despite having a small workbook size and plenty of system RAM.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Sorting worksheets or deleting multiple rows in an Excel workbook.
- Observed behavior
- Excel fails to complete the action and throws an insufficient memory error, often caused by inflated used ranges, complex formulas, add-ins, or file corruption.
Before making structural changes to your workbook, save a backup copy, restart your computer, and ensure all other unnecessary applications are closed to free up system resources.
Clean Up Inflated Used Range and Formatting
Use this solution if your workbook file size is unexpectedly large or if Excel believes there is data in thousands of empty rows.
Excel often retains formatting or invisible characters in cells far beyond your actual data set. This drastically increases the 'used range' of the worksheet, causing Excel to run out of memory when recalculating sorting or deleting actions.
Open your worksheet and press 'Ctrl + End' on your keyboard. This will jump to the last cell Excel considers active. If this cell is far below or to the right of your actual data, you have an inflated used range.
Click the row number of the first completely blank row beneath your actual data. Press 'Ctrl + Shift + Down Arrow' to highlight all rows down to the bottom of the worksheet.
Right-click anywhere in the highlighted row headers and select 'Delete'. Do not just press the Delete key, as that only clears contents but keeps the formatting.
Repeat the process for columns: click the first empty column header to the right of your data, press 'Ctrl + Shift + Right Arrow', right-click the header, and select 'Delete'.
Click 'File' > 'Save' immediately. Excel will reset the used range, freeing up the memory needed to sort or delete your data.

Run Excel in Safe Mode and Disable Add-ins
Use this method if the memory error is caused by conflicting third-party add-ins or background macros.
Use the Open and Repair Tool
Try this if you suspect internal file corruption is causing memory management failures during sorting.
Use WPS Office for Faster, Memory-Efficient Spreadsheet Management
If Excel frequently struggles with memory errors, consider switching to WPS Office. It is a highly compatible, lightweight, and free alternative that processes large datasets and complex sorting smoothly without hogging your system memory.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install and Launch: Run the installer. Once completed, open the WPS Spreadsheets application.
- 3. Open Your Workbook: Click 'File' > 'Open' to directly load your existing .xlsx file and easily perform your sorting or deleting tasks without memory constraints.

Frequently Asked Questions
Why does Excel show an insufficient memory error even though I have plenty of RAM?
Excel is constrained by its own internal memory limits (especially if using the 32-bit version) and application overhead. Complex formulas, excessive conditional formatting, or an artificially large used range can hit these software limits regardless of your computer's total available hardware RAM.
How do I reset the used range in an Excel file to save memory?
Select any cell and press 'Ctrl + End' to jump to the last active cell. Highlight the empty rows and columns between your actual data and that far cell, delete the rows and columns entirely, and immediately save the workbook. Saving the file is required to finalize the boundary reset.
Can conditional formatting cause memory errors when sorting rows?
Yes. When you sort or delete rows, Excel must recalculate every conditional formatting rule applied to those cells. If you have overlapping, duplicated, or highly complex rules applied to entire columns rather than specific data ranges, it can overwhelm Excel's memory allocation.




