Sorting List By Sum Total

  • Hi there,
    I have a worksheet that gives all possible combinations from 8 sets of 3 results (about 6500 combinations), my question is, can I get the generated list of combinations to =sum the rows (each combination), and generate the list (combinations) in numerical order.


    Like this forum.ozgrid.com/index.php?attachment/25946/


    I was wondering if there can be something in the vb code that can do this easily or do i need to manually sum each row and then sort the results.
    If i do have to do this manually, how do i figure out which row the data came from?


    thanks in advance.

  • Re: Sorting List By Sum Total


    Select the range of data (all columns) you want to sort, then use the Data > Sort built in to Excel.
    Sort by column K. You could use column headers, but you didn't put them in columns J or K.



    Use the macro recorder to record your steps then you can use it to sort again after more data is added.


    Quote

    how do i figure out which row the data came from?


    By selecting the full range of columns (currently from A:K) Excel will maintain the relationship so that the results of SUM in "K" are still reflective of whatever the original row is that was first summed.

  • Re: Sorting List By Sum Total


    I think you'll find you missed out column A from the summing and the sorting. Your code doesn't produce duplicate combinations.


    You could also try this code (the original row numbers are in column I:

    p45cal


    postscript: from other's replies I guess you didn't need to know which row the sums came from, but rather which values were involved in making them up - never mind, you've got both now. p45cal

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!