+ Reply to Thread
Results 1 to 12 of 12

Generate unique list and convert data layout

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Generate unique list and convert data layout

    Hi anyone know if there is a way to get the unique value in a range? I tried using unique for range, however, the result take the "unique of combination column" rather than individual cell.

    Also, i would like to know if its possible to Unpivot table using formula.

    Please see my file for clearer picture.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,482

    Re: Generate unique list and convert data layout

    This, for the first part:
    Formula: copy to clipboard
    =UNIQUE(TOCOL(A2:C5))
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Quote Originally Posted by TMS View Post
    This, for the first part:
    Formula: copy to clipboard
    =UNIQUE(TOCOL(A2:C5))
    Thanks! I was trying all sort of things like Vstack etc. hahaha. So funny.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,482

    Re: Generate unique list and convert data layout

    For the second part:
    Formula: copy to clipboard
    =SORT(HSTACK(TOCOL(A2:C5),TRANSPOSE(TEXTSPLIT(REPT(TEXTJOIN(",",,A1:C1)&",",ROWS(A2:C5)),",",,TRUE))),{1,2},{1,1})

  5. #5
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Quote Originally Posted by TMS View Post
    For the second part:
    Formula: copy to clipboard
    =SORT(HSTACK(TOCOL(A2:C5),TRANSPOSE(TEXTSPLIT(REPT(TEXTJOIN(",",,A1:C1)&",",ROWS(A2:C5)),",",,TRUE))),{1,2},{1,1})
    Hi, many many thanks. Impressive.... Don't know when I can reach your 10% power.......

  6. #6
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Quote Originally Posted by TMS View Post
    For the second part:
    Formula: copy to clipboard
    =SORT(HSTACK(TOCOL(A2:C5),TRANSPOSE(TEXTSPLIT(REPT(TEXTJOIN(",",,A1:C1)&",",ROWS(A2:C5)),",",,TRUE))),{1,2},{1,1})
    errr... sorry, can briefy explain the logic at why do you need to textjoin then textsplit again? I have tried to understand, but.... sigh..

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,482

    Re: Generate unique list and convert data layout

    You're welcome.

    Give it time



    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  8. #8
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Hopefully i can reach 50% of your level..... it will be enough for 90% of my work.

    I will mark as solve once i do not have anymore question.

  9. #9
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Generate unique list and convert data layout

    Another solution for the second part:
    Formula: copy to clipboard
    =LET(n,A2:C5,c,TOCOL(n),SORT(HSTACK(c,INDEX(A1:C1,1+MOD(SEQUENCE(ROWS(c),,0),COLUMNS(n)))),{1,2}))
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Quote Originally Posted by HansDouwe View Post
    Another solution for the second part:
    Formula: copy to clipboard
    =LET(n,A2:C5,c,TOCOL(n),SORT(HSTACK(c,INDEX(A1:C1,1+MOD(SEQUENCE(ROWS(c),,0),COLUMNS(n)))),{1,2}))
    The fun part in excel is there is always more than 1 way to do. Its all up to individual's logical idea. Thanks for your alternative suggestion. I will try to digest and see the logic.

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Generate unique list and convert data layout

    Alternatively with Power Query

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
    in
        #"Unpivoted Columns"
    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.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  12. #12
    Forum Contributor
    Join Date
    10-02-2023
    Location
    Singapore
    MS-Off Ver
    Microsoft 365
    Posts
    285

    Re: Generate unique list and convert data layout

    Quote Originally Posted by alansidman View Post
    Alternatively with Power Query

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value")
    in
        #"Unpivoted Columns"
    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.
    Hey. Thanks. But if i use power query, and if i send it to other people, it will always have the "enable content" message right?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. convert five days layout data
    By eugz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-21-2023, 04:28 PM
  2. Generate list of Unique Emails AND sum data in columns
    By How2Excel? in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-23-2020, 05:16 AM
  3. Generate Unique List 2 Columns
    By DKolev in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 07-16-2014, 05:22 PM
  4. [SOLVED] Generate Unique list
    By Cavinaar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-27-2013, 03:03 AM
  5. Convert data from column layout to row layout
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-28-2010, 03:28 PM
  6. Generate a list of unique code
    By luvul in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2009, 04:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1