+ Reply to Thread
Results 1 to 4 of 4

Formula to unpivot data

  1. #1
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    427

    Formula to unpivot data

    Hi,

    Im looking for a formula solution that would help me unpivot a set of data

    For Eg.

    I have ABC 12,13,14 in a row
    which I would like to convert to ABC 12
    ABC 13
    ABC 14


    Attached file for reference


    Thanks in advance
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,158

    Re: Formula to unpivot data

    You need a helper in c2, copied down:

    =LEN(B2)-LEN(SUBSTITUTE(B2,",",""))+1

    Then in G2, this array formula:
    =IFERROR(INDEX($A$2:$A$5,MATCH(0,--(COUNTIF($G$1:G1,$A$2:$A$5)=$C$2:$C$5),0)),"")

    Then in H2, this ordinary formula:
    =IF(G2="","",--TRIM(MID(SUBSTITUTE(","&VLOOKUP(G2,$A$2:$B$5,2,FALSE),",",REPT(" ",125)),125*COUNTIF($G$2:G2,G2),125)))


    Array Formulae are a little different from ordinary formulae in that they MUST be confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER.

    You will know the array is active when you see curly brackets { } - or "curly braces" for those of you in the USA, or "flower brackets" for those of you in India - appear around the outside of your formula. If you do not use CTRL+SHIFT+ENTER you will (almost always) get an error message or an incorrect answer. Press F2 on that cell and try again.

    Don't type the curly brackets yourself - it won't work...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Contributor
    Join Date
    07-12-2015
    Location
    Dubai,UAE
    MS-Off Ver
    Office 365
    Posts
    427

    Re: Formula to unpivot data

    Thanks Glenn

    Works perfect!!

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,158

    Re: Formula to unpivot data

    You're welcome....

+ 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. Replies: 0
    Last Post: 10-25-2016, 02:59 AM
  2. Reshape data and unpivot
    By hpatel517 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2016, 12:22 PM
  3. Unpivot Data with multiple headers grouped
    By ermagl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-16-2016, 05:20 PM
  4. Unpivot Data
    By naveeddil in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-07-2015, 08:04 AM
  5. Unpivot and stack data
    By yching in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-14-2015, 05:18 AM
  6. Unpivot Data
    By Olly in forum Tips and Tutorials
    Replies: 0
    Last Post: 04-02-2014, 05:33 PM
  7. Need 'unpivot' help for attached spreadsheet data.
    By ReneeM787 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-09-2012, 12:21 PM

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