+ Reply to Thread
Results 1 to 15 of 15

Looking for some sort of transpose...

  1. #1
    Registered User
    Join Date
    09-09-2011
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    91

    Looking for some sort of transpose...

    Hi

    I am trying to get data from colums to rows.

    At first i want to modify rows 2to13 (number 1 in column A)

    1) I want to get data from C2:C13 and transpose it to O1:Z12
    2) I want to get data from D2:D13 and transpose it to AG1:AR12
    3)
    -I want to get to H2 some of the numbers 1-12 from B column. The conditon is that if you move three to right from that number there must be number 1 (E-column)
    -I want to get to I2 some of the numbers 1-12 from B column. The conditon is that if you move three to right from that number there must be number 2 (E-column)
    -I want to get to J2 some of the numbers 1-12 from B column. The conditon is that if you move three to right from that number there must be number 3 (E-column)

    After this has been done i move to row from 14to25 (number 2 in column A) and do the same thing...

    How can this be done with some kind of formula...
    Attached Files Attached Files
    Last edited by Ipinho100; 01-09-2016 at 07:56 AM.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Looking for some sort of transpose...

    With 1 and 2 above, you want to transpose 12 cells into 144 cells. I assume that's a typo and you really want )1:A1 and AG1 to AR1?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,819

    Re: Looking for some sort of transpose...

    To answer point 3 first, put this array* formula in H2:

    =INDEX($B$2:$B$3330,MATCH(1,($A$2:$A$3330=ROWS($1:1))*($E$2:$E$3330=COLUMNS($H:H)),0))

    *Note that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE), rather than the usual |Enter|.

    Then you can copy that formula into I2:J2, and then you can copy the formulae from H2:J2 down as far as you need to (to row 295 in your example file - beyond that you will get errors, as you will have run out of data).

    Hope this helps.

    Pete

  4. #4
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Looking for some sort of transpose...

    In O2 copied across and down

    =INDEX($C$2:$C$3330, (ROWS($O$2:$O2)-1)*12+MOD(COLUMNS($O$2:O$2)-1,12)+1)

    Similarly in AG2
    =INDEX($D$2:$D$3330, (ROWS($AG$2:$AG2)-1)*12+MOD(COLUMNS($AG$2:AG$2)-1,12)+1)

    I need to look at your 3rd point more closely.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,366

    Re: Looking for some sort of transpose...

    Transpose to H

    =IFERROR(INDEX($B$1:$B$5000,SMALL(IF($E$1:$E$5000=1,ROW($A$1:$A$5000),""),ROWS($A$1:A1))),"")

    Change 1 to 2 and 3 for I & J

    Enter with Ctrl+Shift+Enter (array formula)

    Non-array version

    =IFERROR(INDEX($B$1:$B$5000,AGGREGATE(15,6,ROW($A$1:$A$5000)/($E$1:$E$5000=1),ROW(A1))),"")
    Last edited by JohnTopley; 01-07-2016 at 04:50 PM.

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,819

    Re: Looking for some sort of transpose...

    For your point 1, you can use this formula in O2:

    =INDEX($C:$C,(ROWS($1:1)-1)*12+COLUMNS($O:O)+1)

    Apply a Custom Format to that cell of General;; (note the two semicolons at the end), so that zero values will show as blanks, and then you can copy across to cell Z2. Then copy O2:Z2 down to row 295.

    For your point 2 you can use a very similar formula - put this in AG2:

    =INDEX($D:$D,(ROWS($1:1)-1)*12+COLUMNS($AG:AG)+1)

    Again apply a Custom Format, then copy across to AR2, then copy AG2:AR2 down to row 295.

    Hope this helps.

    Pete

    EDIT: You can, of course, refer to the values in row 1 instead of the COLUMNS term, i.e. use O$1 instead of COLUMNS($O:O), and AG$1 instead of COLUMNS($AG:AG)

    2nd EDIT: You may need to use a semicolon ( ; ) instead of the commas ( , ) in the formulae
    Last edited by Pete_UK; 01-07-2016 at 04:48 PM.

  7. #7
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Looking for some sort of transpose...

    Hi
    See my proposed solution EXCel help(1).xls

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Looking for some sort of transpose...

    This is one way to do part 3. I changed the column headers from First, Second and Third to 1,2 and 3. These serve as a helper row in the calculations. There is also a helper column started in column G.

    Unfortunately all I can come up with so far is an array formula. In H2 and filled / copied down and across to column J as far as needed. I say unfortunately because array formulas are resource heavy (their will be 882 of them in this step) and can slow the workbook down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.

    So far that part looks like this:

    Row\Col
    G
    H
    I
    J
    1
    1
    2
    3
    2
    1
    6
    10
    2
    3
    2
    11
    3
    1
    4
    3
    5
    7
    3
    5
    4
    5
    3
    2
    6
    5
    4
    10
    1
    7
    6
    7
    2
    8
    8
    7
    3
    9
    7
    9
    8
    5
    3
    6
    10
    9
    11
    4
    9


    Haven't looked at the other parts yet. Looks like a challenge. Would like to find non-array for that.
    Dave

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,819

    Re: Looking for some sort of transpose...

    Hey, Dave,

    congrats on exactly 2,500 posts.

    Pete

  10. #10
    Forum Contributor
    Join Date
    12-05-2015
    Location
    Akron, OH
    MS-Off Ver
    15.0
    Posts
    424

    Re: Looking for some sort of transpose...

    Unless I'm missing something, you have two questions. The first question is one of the most basic problems to solve in excel and less a problem as using the basic functionality of Excel. So if my solution solves your problem, please spend a few minutes on YouTube looking at Excel Tutorials. The second problem is a bit more interesting and along the lines of many of the posts I've seen in this forum.

    First Problem, as I understand it:
    Note: C2: C13 is a 12x1 vector/matrix, where rows/columns are defined: ROWSxCOLUMNS
    ...so a 12x1 vector/matrix transposes to a 1x12 vector/matrix
    ...so if you transpose C2:C13 to another range, where C2 is located at O1, it will occupy: cells: O1: Z1, not Z12 ( so I'll assume Z12 is a typo moving forward)

    That said, how I understand your problem should be a simple solution.

    Second Problem, as I understand it:
    Step 1: write =C2 in O1
    Step 2: write =C3 in P1
    Step 3: highlight O1 and P1 by left clicking (once) with your mouse on O1 and drag your curser to P1 before you release the "left click" on your mouse
    Step 4: hover your mouse over the bottom right corner of the selected range until you see a small plus sign (with black interior)
    Step 5: drag the highlighted region to Cell Z1 by left clicking as soon as step 4 is completed and drag the mouse straight to the right until region O1 to Z1 is highlighted.

    Now the summations are a more interesting problem to solve. First note:
    Note: the following solution ignores conditions:
    Then in H2, write formula: =sum(B1:B12)
    Then in I2, write formula: =sum(B1:B12)
    Then in J2, write formula: =sum(B1:B12)

    Then Note: the sumif(...) function has three arguments, let's call them A, B, and C such that the formula is written: =sumif(A,B,C)
    A: range of conditions
    B: criteria
    C: range to sum

    Thus, your H2, I2, and J2 formulas would be:
    H2: =sumif(E1:E12,1,B1:B12)
    I2: =sumif(E1:E12,2, B1:B12)
    J2: =sumif(E1:E12,3, B1:B12)

    I apologize if I'm wrong about what I understand to be your first problem because I see you've got a fair amount of posts so I'll assume that you spent a lot of time working with excel. In any case, I hope what I said about the first part of this post isn't discouraging. Thank you for your contribution because I'm sure others have the same question. I certainly learned something when I helped with the second part!

    Let me know if there are any other questions or if I can help further.

    Cheers!

    PS Wow! Soooo many posts came before mine by the time I was through! That's why this forum rocks

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,410

    Re: Looking for some sort of transpose...

    Quote Originally Posted by Pete_UK View Post
    Hey, Dave,

    congrats on exactly 2,500 posts.

    Pete
    Thanks Pete. I hadn't even noticed. Do we get a free beer for that? LOL

  12. #12
    Registered User
    Join Date
    09-09-2011
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Looking for some sort of transpose...

    Hi

    Thanks for the help.

    There is one problem. When i drag the formula from o2 to ad2 there comes values also to aa2,ab2,ac2 and ad2. There should not be any values because there should only be values from the c column if there is number one in a column. I put with red color the values which should not be there. I also added few comments to make myself more clear.
    Attached Files Attached Files

  13. #13
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Looking for some sort of transpose...

    Hi
    See the file EXCel help(3).xls

    1st.) in H2 and válid to H2:Jnn (CSE array formula) (post 7)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    2nd.) In O2 and valid to O2:Znn (post 7)
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    3th.) In AG2 and valid to AG2:ARnn sanme as 2nd. but column D
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Regards

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,366

    Re: Looking for some sort of transpose...

    In O2

    =IFERROR(IF(O$1<=COUNTIF($A$2:$A$10000,ROWS($1:2)-1),INDEX($C$2:$C$10000, MATCH(ROWS($1:2)-1,$A$2:$A$10000,0)+O$1-1),""),"")

    in AG2


    =IFERROR(IF(AG$1<=COUNTIF($A$2:$A$10000,ROWS($1:2)-1),INDEX($D$2:$D$10000, MATCH(ROWS($1:2)-1,$A$2:$A$10000,0)+AG$1-1),""),"")


    Copy across and down
    Last edited by JohnTopley; 01-09-2016 at 04:20 AM.

  15. #15
    Registered User
    Join Date
    09-09-2011
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    91

    Re: Looking for some sort of transpose...

    Thank you for everybody. It works now.

+ 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. Sort of Transpose a large array
    By rosnathan in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-01-2013, 07:01 PM
  2. Tricky Transpose and Sort
    By Water Doc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-21-2013, 11:46 PM
  3. [SOLVED] Transpose and Sort
    By Econocrat in forum Excel General
    Replies: 4
    Last Post: 08-20-2012, 11:17 AM
  4. 2-step transpose and sort by unique id
    By stp79 in forum Excel General
    Replies: 2
    Last Post: 08-13-2012, 10:59 PM
  5. Excel 2007 : transpose & sort
    By ola1 in forum Excel General
    Replies: 2
    Last Post: 11-21-2011, 08:26 PM
  6. sort and transpose
    By Back2Basics in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-19-2009, 04:11 PM
  7. Copy Paste Transpose - Sort Of
    By racer25 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2007, 10:33 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