Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Rahul_SC
Helper IV
Helper IV

How to split a master file into many excel workbook based on a column

Hi all,

 

I have a masterfile in excel. I want to split this file into many excel workbooks.  As a sample, below is the table. I want to split this table into excel workbooks based on Column (Subject), so in this condition, I should get two workbooks as there are two different subjects in column (Subject). 

NameSubjectsMarks
AMaths12

A

Science23

B

Science21

B

Maths25

 

Thanks!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Power Query is not the right tool for this as it doesn't produce different Excel files. You will have to do quite a manual work and save all files one by one after applying different filters in PQ.

 

Right tool for this is Excel itself if you want automated version. 

I have written a VBA macro in which you need to select the column and it will generate those many files corresponding to distinct entries. Hence, if you run macro after selecting Subjects column or just selecting any cell in Subjects column, you will get two files.

Article 48 – Split A Workbook into Multiple Workbooks on the basis of a Column

If you are doing some transformations in PQ, do it and save the output in an Excel. Then run the above macro.

View solution in original post

5 REPLIES 5
Vijay_A_Verma
Super User
Super User

Power Query is not the right tool for this as it doesn't produce different Excel files. You will have to do quite a manual work and save all files one by one after applying different filters in PQ.

 

Right tool for this is Excel itself if you want automated version. 

I have written a VBA macro in which you need to select the column and it will generate those many files corresponding to distinct entries. Hence, if you run macro after selecting Subjects column or just selecting any cell in Subjects column, you will get two files.

Article 48 – Split A Workbook into Multiple Workbooks on the basis of a Column

If you are doing some transformations in PQ, do it and save the output in an Excel. Then run the above macro.

Hello! Does this code work the same on PC and MAC (I have a MAC)?

 

Also, can you explain a little bit more how to setup and run the Macro, the shortcut keys don't work on MAC. Is the same if I go to Tools>Macros>Record New Macros>(paste code)? 

 

Thank you!

Hi! 

I would be interested in the VBA Code, but the link provided doesn't work. It gets me to a general page where it presents different courses. 

The link is still not working. Can you provide a new one?

thanks

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.