+ Reply to Thread
Results 1 to 5 of 5

want to covert data from columns to row as per attached details

Hybrid View

mahesh.mohite want to covert data from... 08-29-2024, 05:13 PM
TMS Re: want to covert data from... 08-29-2024, 06:39 PM
Czeslaw Re: want to covert data from... 08-30-2024, 01:29 AM
AliGW Re: want to covert data from... 08-30-2024, 01:38 AM
djclements Re: want to covert data from... 08-30-2024, 04:58 AM
  1. #1
    Registered User
    Join Date
    08-29-2024
    Location
    Mumbai
    MS-Off Ver
    MS365
    Posts
    1

    Post want to covert data from columns to row as per attached details

    I want to capture start date and end date in single row for duplicate names


    Name Start Date End Date
    Aditya 01-Jul-23 30-Sep-23
    Aditya 01-Oct-23 31-Dec-23
    Aditya 01-Jan-24 31-Mar-24
    Aditya 01-Apr-24 30-Jun-24
    Aditya 01-Jul-24 30-Sep-24
    Rajesh 26-Aug-23 30-Sep-23
    Rajesh 01-Oct-23 31-Dec-23
    Rajesh 01-Jan-24 31-Mar-24
    Rajesh 01-Apr-24 30-Jun-24
    Rajesh 01-Jul-24 07-Jul-24
    Pavan 01-Jul-23 30-Sep-23
    Pavan 01-Oct-23 31-Dec-23
    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,359

    Re: want to covert data from columns to row as per attached details

    There will be a better way, but, for the moment, try:

    H8:
    Formula: copy to clipboard
    =UNIQUE(A5:A37)

    I8, copied down:
    Formula: copy to clipboard
    =LET(tr,TOROW(FILTER($B$5:$D$37,$A$5:$A$37=H8)),IF(tr="","",tr))
    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 Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,417

    Re: want to covert data from columns to row as per attached details

    Power Query
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Start Date", type date}, {"End Date", type date}}),
        #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Changed Type", {{"Start Date", type text}, {"End Date", type text}}, "lt-LT"),{"Start Date", "End Date"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Merged"),
        #"Grouped Rows" = Table.Group(#"Merged Columns", {"Name"}, {{"Count", each _, type table [Name=text, Merged=text]}}),
        #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [Count][Merged]),
        #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), "-"), type text}),
        #"Split Column by Delimiter" = Table.SplitColumn(#"Extracted Values", "Custom", Splitter.SplitTextByDelimiter("-", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3", "Custom.4", "Custom.5", "Custom.6", "Custom.7", "Custom.8", "Custom.9", "Custom.10"}),
        #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", type date}, {"Custom.2", type date}, {"Custom.3", type date}, {"Custom.4", type date}, {"Custom.5", type date}, {"Custom.6", type date}, {"Custom.7", type date}, {"Custom.8", type date}, {"Custom.9", type date}, {"Custom.10", type date}}),
        #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"Count"})
    in
        #"Removed Columns"v
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,777

    Re: want to covert data from columns to row as per attached details

    All in one spill formula:

    =LET(u,UNIQUE(A5:A37),tr,DROP(REDUCE("",u,LAMBDA(x,y,VSTACK(x,TOROW(FILTER($B$5:$D$37,$A$5:$A$37=y))))),1),HSTACK(u,IFNA(IF(tr=0,"",tr),"")))
    Attached Files Attached Files
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Contributor
    Join Date
    08-19-2024
    Location
    Philippines
    MS-Off Ver
    MS365 for Business
    Posts
    113

    Re: want to covert data from columns to row as per attached details

    Another possible workaround to output an "array of arrays" (incl. headers) with MAP could be:

    =LET(
        hdr, HSTACK(B4:C4, ""),
        unq, UNIQUE(TOCOL(A5:A1000, 1)),
        arr, MAP(unq, LAMBDA(v, TEXTJOIN("|", 0, "", FILTER(B5:D1000, A5:A1000=v), ""))),
        num, MAX(LEN(arr) - LEN(SUBSTITUTE(arr, "|", ))) - 1,
        VSTACK(
            HSTACK("Name", TOROW(IF(SEQUENCE(num/COLUMNS(hdr)), hdr))),
            HSTACK(unq, IFERROR(--TEXTBEFORE(TEXTAFTER(arr, "|", SEQUENCE(, num)), "|"), ""))
        )
    )
    See attached, if needed...
    Attached Files Attached Files

+ 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. [SOLVED] Filter//paste data to 2 columns (title & details), autofill titles to match details
    By Frankximus3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2016, 03:10 AM
  2. Replies: 7
    Last Post: 01-18-2016, 05:57 AM
  3. Replies: 2
    Last Post: 01-15-2016, 08:29 AM
  4. Employee Details with attached picters
    By Nisar.mohammed in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2015, 04:04 AM
  5. Setting up some VBA to enter details into a complex form (spreadsheet attached!)
    By AdamLord in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2011, 10:57 AM
  6. Update columns with data (Please see attached xls file)
    By pr4t3ek in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2009, 11:11 PM

Tags for this Thread

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