+ Reply to Thread
Results 1 to 9 of 9

Transpose-sheet containing a matrix of mixed dates and values.

  1. #1
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329

    Transpose-sheet containing a matrix of mixed dates and values.

    Hello.

    I have a sheet containing a matrix of mixed dates and values.
    I am trying to transpose this inte another form of matrix where dates is in columns instead of rows.

    I need this to be dynamic.
    I've tried functions such as Index, Match and lookup but I can't seem to make it work.

    I have attached an excel sheet of how I need it to be transfered.

    I hope someone know how to do this.

    /Anders
    Attached Files Attached Files

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transpose problem

    If I've understood...

    K2: =INDEX($B:$H,COLUMNS($K2:K2)+6*INT((ROWS(K$2:K2)-1)/7),1+MOD(ROWS(K$2:K2)-1,7))
    applied across matrix K2:N16

    It would of course make more sense to store the ROWS count adjacent to the table so as to avoid repetitive calcs, eg:

    J2: =ROWS(J$2:J2)
    copied down to J16

    then the above is shortened to

    K2: =INDEX($B:$H,COLUMNS($K2:K2)+6*INT(($J2-1)/7),1+MOD($J2-1,7))
    applied across matrix K2:N16

    (change delimiter from comma to semi-colon if required - your locale is not specified)

  3. #3
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Transpose problem

    is it set out just like that?
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  4. #4
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329

    Re: Transpose problem

    Hello.

    I worked tremendously well. Very happy!
    What if I'd want it so be in vertikal mode instead with dates on row 2 and the values on row 3, 4, 5?

    Do you have the same quick answer for that question as well?

    Thanks
    /Anders

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transpose problem

    Well I wouldn't do that because you should generally look to store your data such that you have the largest quantity of data on the vertical axis (ie more rows than columns)

    However, purely for sake of demo... let's use a different range for results - ie leave the existing solution as is.

    P1: =COLUMNS($P1:P1)
    copied across to AC1

    P2: =INDEX($B:$H,ROWS($P$2:$P2)+6*INT((P$1-1)/7),1+MOD(P$1-1,7))
    copied across matrix P2:AC5

    (again change delimiter as required)

  6. #6
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329

    Re: Transpose problem

    Hello.

    I need to do a change and add more rows above the data I'm having.
    When I do that it doesn't work any longer.

    On row 9 my "real" data starts and goes to row 326.

    I add my workbook again with your code in it.

    /Anders
    Attached Files Attached Files

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transpose problem

    I'm afraid I don't understand - the sample file works and bears no relation to the ranges you specify in your last post.

  8. #8
    Forum Contributor
    Join Date
    03-14-2005
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    329

    Re: Transpose problem

    Hello.

    Sorry for my bad english. I'm swedish so sometimes it is not so clear for you I understand.
    If I insert rows on row 1 the code does'nt work.
    Try and see for yourself. Do you have a clue?

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Transpose problem

    Quote Originally Posted by Anders
    If I insert rows on row 1 the code doesn't work.
    If you're physically inserting / removing rows then yes - as you would expect - the formulas will no longer work.
    Equally, if there is no consistent pattern to the "groups" of data (ie rows in each "block") then a formula based approach will be very complex (if viable at all).

    I'm not quite sure what you were expecting...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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