+ Reply to Thread
Results 1 to 14 of 14

Ordering one table by the rules from another table

Hybrid View

  1. #1
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Ordering one table by the rules from another table

    Hello there!

    I'm trying to organise two table of matching values by descending order. Here the values in the columns A-B-C-D respectively correspond to ones in columns E-F-G-H (A correspond to E, B to F, etc.). I would like to order the contents of A-B-C-D table and reorganise the E-F-G-H table to keep this relationship.

    I include the example file to showcase my idea. I'm looking for formula ideas to automate this process.

    Thanks!
    Attached Files Attached Files
    Last edited by sulin360; 08-25-2013 at 06:01 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Ordering one table by the rules from another table

    Hi,

    Are you sure all your green results are correct? See attached. The formulas give the right result for the yellow table but only agree with the first row of your green table. If yours are correct can you explain the working.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    Are you sure all your green results are correct? See attached. The formulas give the right result for the yellow table but only agree with the first row of your green table. If yours are correct can you explain the working.
    Yep, it was wrong! I've fixed it now. Sorry.

  4. #4
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Hi, OP here. The original file was incorrect (my bad!), so I fixed it.

    I've attempted solving this problem myself, but I did't get too far with it. Here is what I have now.

    Here the red table lists the new positions of the entries in the green table. So that to get a new green table the old one should rearrange itself in the way listed in the red one. I've mistakenly used the LARGE function to get there (blue table), but the logic was flawed.
    Attached Files Attached Files
    Last edited by sulin360; 08-25-2013 at 06:15 PM.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Ordering one table by the rules from another table

    OK,

    I hope we're not going round in circles here, but your new green table in N1:Q9 now agrees with the table I gave you in the workbook I attached originally, in E13:H21.

    i.e. I queried whether your original table was correct and you agreed it wasn't and you had made a mistake. I believe that this means that my first solution was correct. Do you agree now.

  6. #6
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Quote Originally Posted by Richard Buttrey View Post
    OK,

    I hope we're not going round in circles here, but your new green table in N1:Q9 now agrees with the table I gave you in the workbook I attached originally, in E13:H21.

    i.e. I queried whether your original table was correct and you agreed it wasn't and you had made a mistake. I believe that this means that my first solution was correct. Do you agree now.
    Sorry, I missed it completely!

    The solution almost works, however the formula produces anomalies when it deals with two ordering possibilities. E.g. if you look at rows 8 and 20 the solution is 50-67<->44-86 (where 67 and 44 are interchangeable), but the formula results in double 67s, which is not in the original data.

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Ordering one table by the rules from another table

    Quote Originally Posted by sulin360 View Post
    Sorry, I missed it completely!

    The solution almost works, however the formula produces anomalies when it deals with two ordering possibilities. E.g. if you look at rows 8 and 20 the solution is 50-67<->44-86 (where 67 and 44 are interchangeable), but the formula results in double 67s, which is not in the original data.
    Hi,

    OK, here's a mod which now picks up and allows for there being duplicate values in a row.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Hi, thanks for your help, Richard.

    Is there a way to allow for such duplicates in the other places? The data I'll be restructuring has over 12000 rows, so I'm sure there will be all sorts of possible permutations of such anomalies. Here is your file where I made up some data to reveal problems with code.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Nah, I still don't have it...
    Last edited by sulin360; 08-25-2013 at 05:40 PM.

  10. #10
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Ordering one table by the rules from another table

    OPk

    I have a formula for you

    
    =OFFSET($E1,0,MATCH(J1,$A1:$D1,0)-1)
    Your Sample data is wrong in rows 3, 4 and 8 ( All row 3, All row4, and last column row 8)
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Quote Originally Posted by mehmetcik View Post
    OPk

    I have a formula for you

    
    =OFFSET($E1,0,MATCH(J1,$A1:$D1,0)-1)
    Your Sample data is wrong in rows 3, 4 and 8 ( All row 3, All row4, and last column row 8)
    Thanks for your efforts! I really appreciate it! There is a problem however. In the row 8 of your file you can see that the OFFSET formula produces double 67s instead of 67-44 (interchangeable order).

  12. #12
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Ordering one table by the rules from another table

    Ok

    I have figured out how to do this with a macro.

    will your data always be in this format?

  13. #13
    Registered User
    Join Date
    06-27-2013
    Location
    Coventry, England
    MS-Off Ver
    Excel 2010
    Posts
    34

    Re: Ordering one table by the rules from another table

    Quote Originally Posted by mehmetcik View Post
    Ok

    I have figured out how to do this with a macro.

    will your data always be in this format?
    Unfortunately no, there will be all sorts of formats I'll have to use. So formula solution is much preferred... I'll edit my previous entries to show what I have so far in a second.

  14. #14
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Ordering one table by the rules from another table

    Hi

    Sorry about the delay.

    had to do some stuff in the garden.

    Here is your file.
    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] Ordering chronologically in a pivot table
    By Falc in forum Excel Charting & Pivots
    Replies: 12
    Last Post: 07-30-2013, 09:11 AM
  2. Alphabeltical ordering in table - results don't make sens
    By studiosa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-30-2013, 11:10 AM
  3. Replies: 0
    Last Post: 10-13-2011, 06:31 PM
  4. Excel 2007 : Ordering Conditional Format Rules
    By jahteacher in forum Excel General
    Replies: 0
    Last Post: 09-28-2011, 09:01 PM
  5. Replies: 7
    Last Post: 01-09-2006, 01:45 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