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

how to arrange the data

s_balasubramanian

New Member
how to get/arrange the data as below.
Original Data I haveNeed like below
TeamCodeCnameTeamActLLKKUU
C54KKA
A11ActB
A12LLC
A13KKD
B21Act
B12LL
B23KKin Excel 2016
C31Act
D41Act
A14UU
C66UU
C43LL
[td]
11​
[/td]​
[td]
12​
[/td]​
[td]
13​
[/td]​
[td]
14​
[/td]​
[td]
21​
[/td]​
[td]
12​
[/td]​
[td]
23​
[/td]​
[td]
31​
[/td]​
[td]
43​
[/td]​
[td]
54​
[/td]​
[td]
66​
[/td]​
[td]
41​
[/td]​
 

Attachments

Pivot your data using Power Query
Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Cname]), "Cname", "Code")
in
    #"Pivoted Column"
 

Attachments

if i have alfanumeric data, how can i arrange it. new file attached
Will work the same if you use the power Query Mcode that I showed in post #2. Makes no difference if the values are alpha, alpha numberic or numeric.
 
vba, if you like.
Code:
Sub test()
    Dim s$(1), i&, r As Range
    Set r = Sheets("sheet1").[j3]
    s(1) = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & ThisWorkbook.FullName & _
         ";Extended Properties='Excel 12.0 xml;HDR=Yes';"
    s(0) = "Transform First(Code) Select Team From `Sheet1$F3:H` Group By Team Pivot Cname;"
    With CreateObject("ADODB.Recordset")
        .Open s(0), s(1), 3, 3, 1
        For i = 0 To .Fields.Count - 1
            r(, i + 1) = .Fields(i).Name
        Next
        r(2).CopyFromRecordset .DataSource
        .Close
    End With
End Sub
 

Attachments

vba, if you like.
Code:
Sub test()
    Dim s$(1), i&, r As Range
    Set r = Sheets("sheet1").[j3]
    s(1) = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & ThisWorkbook.FullName & _
         ";Extended Properties='Excel 12.0 xml;HDR=Yes';"
    s(0) = "Transform First(Code) Select Team From `Sheet1$F3:H` Group By Team Pivot Cname;"
    With CreateObject("ADODB.Recordset")
        .Open s(0), s(1), 3, 3, 1
        For i = 0 To .Fields.Count - 1
            r(, i + 1) = .Fields(i).Name
        Next
        r(2).CopyFromRecordset .DataSource
        .Close
    End With
End Sub
Thanks
 
sir

i have attached the exact data need for this request
please provide any macros in details to get the data like in sheet31 and i'm new to this
to understand the macros, please suggest any you tube video link if possible
 

Attachments

One sample

Usage:
# Have data in rawdata-sheet
# Select Output-sheet

To Understand Macros:
# Try to read row by row - what is going on?

Bonus:
# Select any Code to see ... those.
 

Attachments

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.
 
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.
thanks for your support
 
Back
Top