Handling a large file is important as it takes a huge amount of time to transfer. A large file takes too much time to open. Any kind of change in a large file takes a long time to update. So, reducing file size is important.
In this article, we will see how to reduce a large Excel size. There are many methods of doing that. We will be choosing the best options here.
In our analysis, we use a sample data of a superstore sales. The sample was downloaded from this link https://community.tableau.com/docs/DOC-1236.
The original file size of this sample is 3,191 KB.
Table of Contents
- 1 Saving a file in Excel binary format
- 2 Deleting/Clearing blank cells in Excel
- 3 Checking Conditional Formatting
- 4 Check and Delete unnecessary hidden cells
- 5 Optimizing Excel formulas
- 6 Commanding Excel manual calculation
- 7 Customizing Pivot Tables
- 8 Using VBA code to reduce file size
- 9 Reduce Excel file size with pictures
- 10 Formatting file from File properties
- 11 Compress excel file to ZIP/RAR
- 12 Find what causes large Excel file size
- 13 Conclusion
Saving a file in Excel binary format
Saving the excel file from a .xlsx format to excel binary format (.xlsb), reduce the size of your file around 40%. This is the easiest and most efficient way of reducing your file size. The procedure is given below.
We will be saving our sample excel file in .xlsx format and then in XLSB format to check whether the file size is reduced or not.
The two files are saved in the same directory. Now we will see if the file size of the .xlsb file is reduced or not.
We can see the XLSB file contains 1,666 KB where the XLSX file contains 3,191 KB. So, the file size is reduced on a large scale.
Excel binary workbook Pros and Cons
- The Excel binary file uses noticeably less space while saving than XLSX files.
- Loading binary data is faster than parsing text (XML) files or XLSX files.
- Macros, VBA code is fully supported.
- No Ribbon modification allowed for XLSB formats. You must convert back to XLSM, make your Ribbon changes, and then back to XLSB.
- Not compatible with Excel 2003 and previous versions.
- XLSB is a binary file format, unlike the open XML, XLSX and XLSM files. Hence you often won’t see your XLSB files working everywhere.
Deleting/Clearing blank cells in Excel
After you complete a task in Excel workbook, there are so many unused cells which have no usefulness in your workbook. Sometimes you accidentally do some formatting in these unused cells which actually increase your file size. Removing the formatting from these blank cells reduce your file size.
If you want to select the entire blank cells just click CTRL+Shift+ ↓+ → together. The arrow signs indicate where you want to put your command.
After selecting the blank cells, In the Home tab on Clear option press Clear all. This will clear the cells.
There is another way of doing that.
On the Home tab, Press Find & Select and then press Go To Special. It will open up a box. On that box tick on the Blanks and press OK. This will automatically find the blank areas of your Excel workbook. After this clear the blank cells as we did earlier.
Checking Conditional Formatting
In excel, Conditional formatting visualizes data and make worksheets easier to understand. But sometimes we do mistakes while applying conditional formatting. Sometimes we apply formatting to an entire sheet or an entire group of rows or columns. To minimize the mistake, we can go to Conditional Formatting > Manage Rules and check the cell range of each of the rules. Again if we somehow apply conditional formatting in the excel workbook and suddenly realize we don’t need that we can undo the conditional formatting by clearing rules from entire worksheet.
Sometimes unnecessary hidden cells are the reason for larger excel file. You may accidentally hide some rows or columns of the excel worksheet you are working on. Suddenly you realize that your file contains some hidden elements which you don’t require. All you can do is to unhide the rows and columns of the excel worksheet and see if you need them or not. If you don’t need them just delete them all.
Optimizing Excel formulas
Apart from reducing file size directly, we can optimize the excel formulas so that the calculation can be made faster hence the file size can be reduced. There are so many ways to do that.
1. Avoid using volatile formulas
There are seven volatile functions in excel which are RAND (), NOW (), TODAY (), OFFSET (), CELL (), INDIRECT () and INFO (). These formulas are recalculated whenever there is a change in the excel file. If your worksheet has a lot of volatile formulas then the calculations become slow hence the file size is increased. So, the solutions are simple, we should avoid using volatile formulas. There are some alternatives to some volatile formulas. They are given below
- Instead of OFFSET, we can use INDEX
- Within a worksheet INDEX function can be used by using column number rather than letters to replace INDIRECT functions.
- There is no alternative for NOW and TODAY functions. But VBA code can be used to replace them. Like for Now functions, we can use-
Private Sub Workbook_Open ()
Range(“A1”). Value = Time
For TODAY functions we can use
Private Sub Workbook_Open ()
Range(“A1”). Value = Date
- The RAND functions are not required most of the time. However, if we do require a new random number we could use a VBA function to generate it.
Private Sub Workbook_Open ()
Range(“A1”). Value = Rnd ()
- INFO and CELL are not particularly common formulas. They provide system, workbook and cell status information. Instead of using them we can use the file path or cell color reference number using VBA.
2. Use Pivot Tables or Excel Tables
Instead of series of formulas using Pivot tables or excel tables is an efficient way to show your result
3. Avoid referencing entire rows or columns
SUMIF () or VLOOKUP () functions look for data in the entire columns or rows. Instead of referencing entire data we can refer only a few cells if needed. Like-
Instead of using =SUMIF (A: A, $C4, B: B)
We can use =SUMIF (A1:A50, $C4, B1:B100)
Here we are referring to the 1st 50 cells of Column A.
4. Avoid repeated calculations
Let’s say you have a formula which contains “=$A$3+$B$3”, and you copy that formula to fifty cells. Here the total number of cell references is hundred, despite the number of unique cells only being two. But if C3 has a formula which is =A3+B3, and you want to update those on 50 other cells, just by referring cell C3 in those 50 cells you can actually make the number of reference 50, whereas your previous referencing required a hundred cells.
Commanding Excel manual calculation
This actually helps you to calculate faster in excel. But sometimes in large excel files doing manual calculations can also help you to reduce your file size.
Customizing Pivot Tables
Pivot Tables are created for quickly checking data or gaining an overview. This pivot tables may increase your file size if you don’t need them anymore. If you don’t require your pivot tables in your next calculations, you can do the following steps.
- Don’t save the source data with the file.
- Right-click on the Pivot Table and then click on Pivot Table Options.
- On the data tab remove the tick from ‘Save source data with file’.
Using VBA code to reduce file size
Although the available techniques to reduce file size is efficient enough but we can also use VBA code to reduce file size. The technique requires a huge VBA code and sometimes it’s not that much effective than other methods. I haven’t use the VBA code technique in this article, but if you want to find how it is done you can follow the link below.
Reduce Excel file size with pictures
Sometimes when you add pictures in excel worksheet the file size of excel automatically increases. You can reduce the size of the picture outside the excel or within the excel. If you want to do it within the excel, select the picture and right click on the mouse button and select Size and Properties. A Format Picture window will open up on the right side of the excel worksheet. Now you can manually select the height and width of your picture.
You can manually resize your picture outside of excel. There are so many procedures for doing that.
Note: Formatting pictures outside of excel is a good practice rather formatting pictures within the excel.
Formatting file from File properties
After doing all the task in excel it’s easier to compact the size of an excel file from file properties. It’s a windows feature and is not directly related to excel. The procedure is given below.
- Right-click on the file.
- Select Properties.
- Next Select the Advanced button.
- Finally, select “compress contents to save disk space” and press OK.
Note: It’s not a good practice to reduce the size of excel file from file properties as the size is hardly reduced. It is better to use WinRAR for file compressing.
Compress excel file to ZIP/RAR
Many words processing documents can be compressed to 10 percent of their original size by using different compressed tools. It`s a good practice to share files by compressing them. It not only reduces the file size but it also makes the file secure from the virus. Here we will be using WinRAR to compress the file. The procedure is given below.
- Right click on your file.
- Press Add to archive.
- A dialogue box will come up choose RAR/ZIP as an Archive format.
Find what causes large Excel file size
It’s difficult to find which portion of your excel file is causing larger file size. There is a way to find out by means of saving your excel file as a web page. In this way, you can separate out each object in your file and examine its contribution to the overall file size. The procedure is given below
- Save your file
- Save as a completely new name so that you can work with the main file later
- Save as Web page and in a New folder
- Open Explorer
- Navigate to where you saved the file
- Open the folder with the same name as your file
- Sort descending by the file size
Here The largest object will be named at the top.
Note: This technique doesn’t help you to reduce file size. It is provided in this article to help you find which part of your excel file is causing larger file size.
Most people find it easy to share small sized files. As we can see there are many methods of doing that. Compressing file size also makes it easy for speeding up the excel calculation.
We can use these techniques separately or together to reduce our file size.