Split an Excel File in to Many using VBA [Videos]
Splitting an Excel file in to many is easier than splitting bill in a restaurant among friends. All you need is advanced filters, a few lines of VBA code and some data. You can go splitting in no time.
Lets say you have lots of data like this in a file. And you want to split this in to multiple files, one per salesperson.
Solution – Split Data in to Multiple Files using Advanced Filters & VBA
The process of splitting data can be broken down to 4 steps.
- Identify the split criteria and list down all values in a small range. In our case, we list all the salespersons names in a named range lstSalesman.
- Set up advanced filters so that we can filter the data by one salesman at a time.
- Now, for each salesman, apply advanced filters and set it to copy the filtered values elsewhere.
- Copy the filtered values
- Add a new workbook and paste the copied values there.
- Save the new workbook with a unique name
- Repeat the above 3 steps for each salesman
- That is all! You are done splitting.
Video Lesson on Splitting Data using Filters & VBA
Since splitting data in to multiple files requires a bit of macro code & advanced filter knowledge, I have created a short lesson explaining how this works. Watch it below.
[If you are not able to see the video, watch it on our Youtube Channel]
If you are new to VBA, take our crash course.
Download Split Data Example Workbook
- Save the downloaded file to any folder.
- Open the file and enable macros.
- Examine everything and when ready, click on “Extract” button.
- Check the folder where you saved the file and you will fine 4 new Excel workbooks named after the salespersons with the data extracted for them.
You can find the macro code in Module 1.
How do you Handle Splitting Situations?
In my work, I rarely had to split data. And whenever I had to split data, I usually copy paste the data after filtering what I want. But I can imagine many real life scenarios where you need to automate the splitting part.
How do you split data? What techniques and ideas you use to speed up the splitting process? Please share using comments.
More on Splitting & Consolidation
If you are in to splitting or combining things, we have a selection of tips & examples to help you. Check out these articles.
- Consolidating Data in Excel – a collection of techniques & tips
- Split Text on new line using VBA
- Combining Data using Excel’s Consolidate Feature
- Using 3D References to Consolidate Data
PS: Heck, we have even have an Excel tip to tell you how to split expenses among friends 😛
PPS: You can use Pivot Table Report Filters if you want to split data in to multiple sheets.
My name is Chandoo. Thanks for dropping by. My mission is to make you awesome in Excel & your work. I live in Wellington, New Zealand. When I am not F9ing my formulas, I cycle, cook or play lego with my kids. Know more about me.
Thank you and see you around.
|« Quickly Fill Blank Cells in a Table [Reader Tip]||Thank you, We have a home [personal story] »|