• 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.

Macro 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

TDEEXcel

New Member
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
 

vletm

Excel Ninja
TDEEXcel
Your sample data has Workshop - number, without any ... prename or so.
You should able to give sample data, which looks as Your real data as well as expected result base that.
The code or me won't guess other variations.
There have to be clear rule for data.
 

AlanSidman

Well-Known Member
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

TDEEXcel

New Member
Thanks Alan. Will look over the tutorials, looks like your file may fit the bill and user friendly for our end users.
 
Top