• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Power Query support to clean data

TDEEXcel

New Member
Hi,
Hoping you can help me with the attached file. I need the data in the import subtab to be displayed in the way its shown in the clean data tab.
Context: We have a booking system for vulnerable adults whom we make appointments with.
Periodcally we need to extract the data from the system, when we do it provides us the data in the way shown on the import tab (for each client the work shop number is incremented, so workshop 1 is the records for client 1 and workshop 2 is the records for the second client and so on).

The end user then finds it difficult to sift through the data. For the purposes of this example file, I have enclosed 3 'workshops', but in a typical month we could have several hundred.
I need a macro to take the data in the firsttab and display it as shown in the second tab.
Im not an excel expert and have scoured the web looking for pointers - to no joy.

Thanks in advance for any support you can give us.

Regards,
EJ.
 

Attachments

  • Import to Clean data Macro Help.xlsm
    11.4 KB · Views: 7
Thank you for responding so quickly. This looks like it will work great.
I tried this with some real data, so instead of Workshop - 1, I have the following for a colleague called John. But the VB doesnt seem to like it even after me trying to adjust the code (with my very limited knowledge). Can the code be adapted to suit this please?
John's Workshop - 1 DOB
John's Workshop - 1 Email
John's Workshop - 1 First Name
John's Workshop - 1 Referral
John's Workshop - 1 Outcome
John's Workshop - 1 Surname
John's Workshop - 1 Telephone Number
 
Here is a solution that was created with Power Query also called Get and Transform Data and found on the Data Tab.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Character Transition" = Table.SplitColumn(Source, "Column1", Splitter.SplitTextByCharacterTransition({"0".."9"}, (c) => not List.Contains({"0".."9"}, c)), {"Column1.1", "Column1.2"}),
    #"Pivoted Column" = Table.Pivot(#"Split Column by Character Transition", List.Distinct(#"Split Column by Character Transition"[Column1.2]), "Column1.2", "Column2"),
    #"Changed Type" = Table.TransformColumnTypes(#"Pivoted Column",{{" DOB", type date}})
in
    #"Changed Type"

Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 

Attachments

  • Import to Clean data Macro Help.xlsm
    26.9 KB · Views: 3
Thanks Alan. Will look over the tutorials, looks like your file may fit the bill and user friendly for our end users.
 
Hi forum members/Alan,

You kindly helped me a couple of weeks ago and introduced me to power query. Thanks for the tutorials they have been insightful and I have been able to start to build my knowledge on this.

I come to you looking for an adjusted solution to the linked to the above problem if you can support please.

The attached file has a sub sheet that has import data. I need the import data to be split into multiple subsheets with each subsheet showing:
1. From the import sheet: the first 12 cells in each row as a header to the subsheet (this is effectively the title of the subsheet highlighting information of the session).
2. Each participant attending that particular session displayed in the subsheet (as shown in my second subsheet - 3 DW Workshops)

I have shown two subsheets as how I would like the data displayed please for the two calendars in the import data.
In a real life scenario, the import tab could have up to 30 calendars - therefore 30 respective subsheets.

Sorry if I have over complicated the narrative above - but hopefully self explanatory when you open up the spreadsheet attached.

Thank you in advance for your help and reading up to this point.
I look forward to hearing back

TDE.
 

Attachments

  • Test Data Dec 2021.xlsx
    22.3 KB · Views: 6
Back
Top