Why does formatting a specific range (vs entire columns) result in such a big file size difference?

d0rian

Active Member
Joined
May 30, 2015
Messages
313
Office Version
  1. 365
I've been trying to troubleshoot why my file has crept up in size to 23MB. One of my worksheets I regularly fill with several thousand rows of data (never more than 6,000 rows), and so I formatted each column of cells down to Row 5999. E.g. Range A4 : A5,999 is red font, number to 2-decimals, range B4 : T5,999 is blue, formatted as percentages, etc etc all the way out to column IQ.

I found that when I applied my desired column formatting in this fashion (each time from rows 4 through 5,999), it resulted in nearly a 5MB larger file size compared to when I just apply the desired formatting to the entire column. Why is that? I did some reading, and if anything sources seemed to imply the opposite: that you should only apply formatting to the portion of a range you intend to use. Since my data never fills more than 6,000 rows, I thought I was applying best practices by restricting formatting to that range. I'm clearly missing something about how Excel treats blank cells, entire column ranges, etc....?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I'm not absolutly sure but I think your sheet is partially corrupted. If you have only data (no formulas) I suggest taht the best thing to do is create a new file and paste the data copied from the old file only as Value and then apply your formatting to this new sheet.
 
Last edited:
Upvote 0
Well, you probably need to Debug your macros.
 
Upvote 0
Do a CTRL + End on each sheet and see what cell the cursor goes to !!
If it goes Waay down each sheet try running this code.
This can also happen if your data is imported from an outside source.
VBA Code:
Public Sub MM1()
Dim ws As Worksheet
For Each ws In Worksheets
    ws.Activate
    ActiveSheet.UsedRange
Next ws
End Sub
 
Upvote 0
I found that when I applied my desired column formatting in this fashion (each time from rows 4 through 5,999), it resulted in nearly a 5MB larger file size compared to when I just apply the desired formatting to the entire column. Why is that?
According to TechRepublic ...
Formats are probably the biggest culprit for the average user. For the most part, you just have to live with that. You can help avoid bloat by deleting formats when you delete data (admittedly, that’s difficult to do). Also, use column and row formats on large areas instead of individually formatted cells. If you format 500 cells, Excel saves 500 formats. If you format a column, Excel saves just one format.
 
Upvote 0
Re: If you format 500 cells, Excel saves 500 formats. If you format a column, Excel saves just one format.
This jives with what the OP mentions in his first post.
This is darn good to know Peter. I've always, if needed at all, just formatted the "Used Range"
 
Upvote 0
If you format 500 cells, Excel saves 500 formats. If you format a column, Excel saves just one format.

Correct, but be careful. If you format a column, then change the format in one cell of the column, that's like formatting each cell differently.

It might be better to define a cell style, and apply it to the relevant cells.
 
Upvote 0
Thanks Jon. Back to the way I did I guess.
@ Peter & Jon. Have a good weekend and keep on bringing out these tidbits to learn from.
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top