A P3C Technologies help article  |  Updated September 25, 2026

The short version

We recently worked on a workbook that had grown to 104 MB. It held about 17,000 actual values. Excel was storing formatting for roughly 40 million empty cells, because someone had color-coded entire rows instead of just the data. After the fix below, the same workbook was 4 MB — a 96% reduction — with nothing lost.

What’s actually going on

When you click a row number and apply a fill color, you haven’t formatted the row you can see. You’ve formatted all 16,384 cells in it, out to column XFD, Excel’s last column. Depending on how the formatting was applied — especially when rows are formatted, then partly re-formatted, copied, or pasted over time — Excel can end up writing every one of those styled-but-empty cells into the file individually. Across a few thousand rows, that’s tens of millions of cells.

The symptoms: the file is slow to open and save, scrolling lags, OneDrive or SharePoint sync crawls, and the file size makes no sense for how much data is in it. Ctrl+End jumping far past your last real row or column is another tell.

Before you start: work on a copy. Close the workbook, and if it lives in OneDrive, SharePoint, or Teams, download a copy to your desktop. Everything below is read-only until the fix in Step 4, and that step happens on your copy.

Step 1: Try Excel’s built-in cleanup first

Current Microsoft 365 versions of Excel include Review > Check Performance, which looks for formatted cells outside your data and offers to clear them. Run it, save, and check the file size. If it solves the problem, you’re done. If it doesn’t, or your version doesn’t have it, keep going.

Step 2: Find out which sheet is the problem

An .xlsx file is really a ZIP archive full of XML files, one per worksheet, plus styles, shared text, images, and so on. Listing the pieces by size tells you exactly where the weight is. Open PowerShell and run this against your copy (change the path to match):

Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead("C:TempCopy-of-workbook.xlsx")
$zip.Entries | Sort-Object Length -Descending | Select-Object -First 10 FullName,
  @{n='Size MB';e={[math]::Round($_.Length/1MB,1)}},
  @{n='Compressed MB';e={[math]::Round($_.CompressedLength/1MB,1)}} |
  Format-Table -AutoSize
$zip.Dispose()

In a formatting-bloat case, one or two entries named like xl/worksheets/sheet3.xml will dwarf everything else. (If the biggest items are under xl/media/, your problem is pictures, not formatting — compress or remove them instead.)

Matching sheet3.xml to a tab name: the internal numbers don’t always follow the tab order. Copy the file, rename the copy from .xlsx to .zip, and open two small files in Notepad. xl/workbook.xml lists each tab’s name with an ID like r:id="rId3", and xl/_rels/workbook.xml.rels shows which worksheet file each ID points to.

Step 3: Confirm it’s formatting

Don’t open a 100 MB XML file in Notepad — it may never finish loading. Instead, read just the first few thousand characters straight out of the archive:

Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead("C:TempCopy-of-workbook.xlsx")
$reader = New-Object System.IO.StreamReader($zip.GetEntry("xl/worksheets/sheet3.xml").Open())
$buffer = New-Object char[] 5000
$count = $reader.Read($buffer, 0, $buffer.Length)
-join $buffer[0..($count-1)]
$reader.Close(); $zip.Dispose()

The fingerprint: a <dimension ref="..."> that reaches out to column XFD (or close to it), and long runs of cells like <c r="XFC12" s="7"/> — a cell address, a style number, and no value. Those are the empty-but-styled cells you’re paying for.

Step 4: The fix — a two-pass paste into a fresh sheet

The goal is to move only the real data, with its formatting, onto a clean sheet. Order matters here: paste the column widths first, then the content. If you do it in one pass, you’ll lose your column widths.

  1. On the bloated sheet, select just your real data — from A1 to the last cell that actually contains something. Don’t trust Ctrl+End; it will take you to the edge of the bloat.
  2. Copy it (Ctrl+C).
  3. Add a new blank sheet and click cell A1.
  4. Pass 1: right-click A1 > Paste Special > choose Column widths > OK. Nothing appears except your columns resizing. That’s expected.
  5. Pass 2: with A1 still selected, right-click > under Paste Options choose Keep Source Formatting.
  6. Spot-check the new sheet: formatting, formulas, frozen panes, filters, and any conditional formatting.
  7. Delete the old sheet, rename the new one to the old name, and save.

Watch out: if other tabs, other workbooks, charts, or named ranges point at the sheet you’re replacing, deleting it will break those links into #REF! errors. Check first with Formulas > Name Manager and a quick search of the other tabs. If the workbook is wired together in ways you’re not sure about, stop here and give us a call.

Step 5: Check your result

Save, close, and compare file sizes. Re-run the Step 2 script if you want to see the difference piece by piece. Once you’re happy, upload the fixed copy back to where the original lives.

The SharePoint and OneDrive gotcha

If a bloated file has lived in SharePoint or OneDrive for a while, version history has probably been saving a full copy every time someone edited it. Dozens of 100 MB versions add up fast against your storage. Fixing the file doesn’t shrink the old versions. Once the fixed copy is in place and you’ve confirmed it’s good, open the file’s Version history and delete older versions you don’t need, or ask us to handle it.

How to keep it from coming back

  • Format the data, not the row. Select the cells you’re actually using before applying color, borders, or fonts. Avoid clicking row numbers or column letters to format.
  • Use an Excel Table. Click in your data and press Ctrl+T. Tables apply banding and formatting only to your data and extend it automatically as you add rows.
  • Use conditional formatting on a defined range instead of manually coloring rows, and keep the “Applies to” range limited to your data.

Rather not go spelunking in XML? That’s what we’re here for. P3C clients can send us the file and we’ll diagnose it and slim it down.

Call 262.423.6267, email support@p3ctech.com, or submit a support ticket.