+ Reply to Thread
Results 1 to 16 of 16

Rearrange the order of columns of a block by the value of a certain cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Rearrange the order of columns of a block by the value of a certain cell

    Good afternoon Experts!
    As in the the above title can find, my question is the next.
    Given a block, e.g. 100 column, contains 20 row each (A1:CV20). In the end of a calculation the last cell (in row 20th) get a value.
    My "desire" is to get a new block in the end of the calculations where all 100 column will rearranged by the value of the cell in row 20. E.g. at A21:CV40
    Now I have Excel 2019 on my PC.
    Am I clear enough?
    Thnx. in advance!
    Last edited by waterstride; 08-16-2023 at 09:27 AM.

  2. #2
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,800

    Re: Rearrange the order of columns of a block by the value of a certain cell

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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.

  3. #3
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Dear Ali!
    Please find attached my sample file, with (probably sufficiant) expenation.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Try this in B11.

    =INDEX($B$1:$H$9,ROWS($B$11:B11),MATCH(SMALL($B$9:$H$9,COLUMNS($B$9:B$9)),$B$9:$H$9,0))
    copied down and across.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Thank you so much, this is exactly what I need! ThankYoukicsi.gif

  6. #6
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    You are welcome.
    --------------------------------------
    If that takes care of your original question, please click on "Thread Tools" from the menu link above and mark this thread as SOLVED.

  7. #7
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Dear windknife!
    Unfortunatly I couldn't addopt properly the formula to my actual worksheet, see attached.
    I'm realy sorry to bozher you again.
    From the block C1:DZ16 , according the row C16:DZ16 should be assort and copy the content to the yellow field.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Try this in C41.

    =IFERROR(INDEX($C$1:$DZ$16,ROWS($C$41:C41),MOD(AGGREGATE(15,6,($C$16:$DZ$16*10^6+COLUMN($C$16:$DZ$16))/($C$16:$DZ$16>0),COLUMNS($C$41:C$41)),10^6)-2),"")
    copied down and across.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Dear windknife!
    Regret to say, this solution is only 80%
    As you can see, this table contains, a toto friend community tipps and results.
    In the block C2:DZ15 there are the bet of the members and in column EG2:EG15 are the results of the bet.
    In the TOTO the top score in our country the 13+1
    You can see that the basic score is counted at the row 17 and the top 13+1 score calculated and indicated in row 16.
    Now my problem is, thet if anybody hit the top 13+1 score, that is not shown in the new, rearranged block.
    I tried to follow your function, but my knowledge is not enough for that.
    My I get a litle more support from you? Would be highly apprecciated.
    Sincerely your. Iván
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    How about this in C41?

    =IFERROR(INDEX($C$1:$DZ$16,ROWS($C$41:C41),MOD(AGGREGATE(15,6,(SUBSTITUTE($C$16:$DZ$16,"13+1",14)*10^6+COLUMN($C$16:$DZ$16))/($C$16:$DZ$16>0),COLUMNS($C$41:C$41)),10^6)-2),"")
    copied down and across.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Dear windknife!
    Now it's looks like I was thinking about!
    I' will check arround and and marking as closed!
    P.s.: would you tell me please what is it stands for in te function, I mean this part: ....10^6.....?

  12. #12
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    10^6 denotes 10 exponent 6 (1000000)

  13. #13
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    Oooooh,ahh!
    I'm not brave enough to ask for, that why?!
    Now I'm going to copy this new function to a text editor and I will compare to the previous one, to learn a litle bit.

  14. #14
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    The "^" operator can be used instead of POWER to indicate to what power the base number is to be raised, such as in 5^2.

    refer to:

    https://support.microsoft.com/en-us/...a-07fb519c362a

  15. #15
    Registered User
    Join Date
    07-16-2023
    Location
    Hungary
    MS-Off Ver
    Excel 2019
    Posts
    32

    Re: Rearrange the order of columns of a block by the value of a certain cell

    First of all, thank you very much to solve my problem, I houldn't be able to fix it alone.
    At second, I have to confess, that I'm not able to follow the logic of your function.
    A question to the end. Is it a hard task to make this rearrangement in reverse order? I mean in decreasing order, instead of rising?

  16. #16
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,976

    Re: Rearrange the order of columns of a block by the value of a certain cell

    change AGGREGATE(15,6... to AGGREGATE(14,6 ...

+ 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] Rearrange columns with additional columns in required order with code
    By RAJESH SHAH in forum Excel Programming / VBA / Macros
    Replies: 203
    Last Post: 07-22-2023, 01:21 PM
  2. [SOLVED] Code to delete selected columns and rearrange columns in order
    By RAJESH SHAH in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-14-2023, 09:10 AM
  3. [SOLVED] How to rearrange the content order of a cell
    By kyber in forum Excel General
    Replies: 6
    Last Post: 10-07-2021, 12:09 PM
  4. Rearrange/randomize order of words in a cell
    By erikpaulsen in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-25-2018, 04:17 AM
  5. Replies: 3
    Last Post: 03-17-2015, 07:59 AM
  6. How can I rearrange columns value in one fixed order?
    By sonupal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2013, 09:24 AM
  7. Rearrange order of words
    By NPM2 in forum Excel General
    Replies: 3
    Last Post: 11-22-2009, 06:58 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