Dynamically sort list based off associated values with tie-breaker values











up vote
0
down vote

favorite












I'm trying to sort students based off frequency of participation. I have a table that is automatically generated totaling up how often a student has participated in the last few days.
I want it to do 2 things that I can't figure out.




  1. I want it to ignore students that are at 0 removing them from the resulting rankings.

  2. The first number is most important but I want it to reference the next value in the result of a tie.


Short example of table:



Andy - 1 1 2 3
Brad - 0 1 2 3
Cade - 1 2 3 4
Dane - 1 1 1 2


Desired result:



Cade - 1
Andy - 1
Dane - 1


The tie-breaker isn't that important and I figure I can have conditional formatting to remove children at 0, but I still can't seem to figure it out.
The closest formulas I have found in my searching are:



=INDEX($A$10:$A$9,MATCH(ROWS($C$1:C1),$C$1:$C$9,0)) 


This one doesn't work because it returns #N/A for pretty much all students who are tied.



=IFERROR(INDEX($C$1:$C$9,MATCH(SMALL(NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),ROWS($C$1:C1)+SUM(--ISBLANK($C$1:$C$9))),NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),0)),"")


I had this formula that can handle ties but it needs to be OFFSET but I don't know how since it is an array formula. Also, with both these formulas it reverses the ranks with the lowest values at the top. If anyone could assist me I would greatly appreciate it. I'm doing this so that I can give all students a chance to participate equally.










share|improve this question


























    up vote
    0
    down vote

    favorite












    I'm trying to sort students based off frequency of participation. I have a table that is automatically generated totaling up how often a student has participated in the last few days.
    I want it to do 2 things that I can't figure out.




    1. I want it to ignore students that are at 0 removing them from the resulting rankings.

    2. The first number is most important but I want it to reference the next value in the result of a tie.


    Short example of table:



    Andy - 1 1 2 3
    Brad - 0 1 2 3
    Cade - 1 2 3 4
    Dane - 1 1 1 2


    Desired result:



    Cade - 1
    Andy - 1
    Dane - 1


    The tie-breaker isn't that important and I figure I can have conditional formatting to remove children at 0, but I still can't seem to figure it out.
    The closest formulas I have found in my searching are:



    =INDEX($A$10:$A$9,MATCH(ROWS($C$1:C1),$C$1:$C$9,0)) 


    This one doesn't work because it returns #N/A for pretty much all students who are tied.



    =IFERROR(INDEX($C$1:$C$9,MATCH(SMALL(NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),ROWS($C$1:C1)+SUM(--ISBLANK($C$1:$C$9))),NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),0)),"")


    I had this formula that can handle ties but it needs to be OFFSET but I don't know how since it is an array formula. Also, with both these formulas it reverses the ranks with the lowest values at the top. If anyone could assist me I would greatly appreciate it. I'm doing this so that I can give all students a chance to participate equally.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to sort students based off frequency of participation. I have a table that is automatically generated totaling up how often a student has participated in the last few days.
      I want it to do 2 things that I can't figure out.




      1. I want it to ignore students that are at 0 removing them from the resulting rankings.

      2. The first number is most important but I want it to reference the next value in the result of a tie.


      Short example of table:



      Andy - 1 1 2 3
      Brad - 0 1 2 3
      Cade - 1 2 3 4
      Dane - 1 1 1 2


      Desired result:



      Cade - 1
      Andy - 1
      Dane - 1


      The tie-breaker isn't that important and I figure I can have conditional formatting to remove children at 0, but I still can't seem to figure it out.
      The closest formulas I have found in my searching are:



      =INDEX($A$10:$A$9,MATCH(ROWS($C$1:C1),$C$1:$C$9,0)) 


      This one doesn't work because it returns #N/A for pretty much all students who are tied.



      =IFERROR(INDEX($C$1:$C$9,MATCH(SMALL(NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),ROWS($C$1:C1)+SUM(--ISBLANK($C$1:$C$9))),NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),0)),"")


      I had this formula that can handle ties but it needs to be OFFSET but I don't know how since it is an array formula. Also, with both these formulas it reverses the ranks with the lowest values at the top. If anyone could assist me I would greatly appreciate it. I'm doing this so that I can give all students a chance to participate equally.










      share|improve this question













      I'm trying to sort students based off frequency of participation. I have a table that is automatically generated totaling up how often a student has participated in the last few days.
      I want it to do 2 things that I can't figure out.




      1. I want it to ignore students that are at 0 removing them from the resulting rankings.

      2. The first number is most important but I want it to reference the next value in the result of a tie.


      Short example of table:



      Andy - 1 1 2 3
      Brad - 0 1 2 3
      Cade - 1 2 3 4
      Dane - 1 1 1 2


      Desired result:



      Cade - 1
      Andy - 1
      Dane - 1


      The tie-breaker isn't that important and I figure I can have conditional formatting to remove children at 0, but I still can't seem to figure it out.
      The closest formulas I have found in my searching are:



      =INDEX($A$10:$A$9,MATCH(ROWS($C$1:C1),$C$1:$C$9,0)) 


      This one doesn't work because it returns #N/A for pretty much all students who are tied.



      =IFERROR(INDEX($C$1:$C$9,MATCH(SMALL(NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),ROWS($C$1:C1)+SUM(--ISBLANK($C$1:$C$9))),NOT($C$1:$C$9="")*IF(ISNUMBER($C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9),COUNTIF($C$1:$C$9,"<="&$C$1:$C$9)+SUM(--ISNUMBER($C$1:$C$9))),0)),"")


      I had this formula that can handle ties but it needs to be OFFSET but I don't know how since it is an array formula. Also, with both these formulas it reverses the ranks with the lowest values at the top. If anyone could assist me I would greatly appreciate it. I'm doing this so that I can give all students a chance to participate equally.







      excel excel-formula excel-2016






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 16:33









      Daniel Sachs

      74




      74
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Use a helper column. In that column put the following formula:



          =IF(B1=0,"n/a",SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))


          This will return a single number based on the rankings.



          ![enter image description here



          Then in your output column use:



          =IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")


          ![![enter image description here



          Then a simple VLOOKUP to return the first number:



          =IF(I1<>"",VLOOKUP(I1,A:B,2,FALSE),"")


          ![![enter image description here






          share|improve this answer























          • I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
            – Daniel Sachs
            Nov 10 at 2:13












          • I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
            – Daniel Sachs
            Nov 10 at 11:46













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229737%2fdynamically-sort-list-based-off-associated-values-with-tie-breaker-values%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          Use a helper column. In that column put the following formula:



          =IF(B1=0,"n/a",SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))


          This will return a single number based on the rankings.



          ![enter image description here



          Then in your output column use:



          =IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")


          ![![enter image description here



          Then a simple VLOOKUP to return the first number:



          =IF(I1<>"",VLOOKUP(I1,A:B,2,FALSE),"")


          ![![enter image description here






          share|improve this answer























          • I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
            – Daniel Sachs
            Nov 10 at 2:13












          • I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
            – Daniel Sachs
            Nov 10 at 11:46

















          up vote
          1
          down vote



          accepted










          Use a helper column. In that column put the following formula:



          =IF(B1=0,"n/a",SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))


          This will return a single number based on the rankings.



          ![enter image description here



          Then in your output column use:



          =IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")


          ![![enter image description here



          Then a simple VLOOKUP to return the first number:



          =IF(I1<>"",VLOOKUP(I1,A:B,2,FALSE),"")


          ![![enter image description here






          share|improve this answer























          • I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
            – Daniel Sachs
            Nov 10 at 2:13












          • I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
            – Daniel Sachs
            Nov 10 at 11:46















          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Use a helper column. In that column put the following formula:



          =IF(B1=0,"n/a",SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))


          This will return a single number based on the rankings.



          ![enter image description here



          Then in your output column use:



          =IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")


          ![![enter image description here



          Then a simple VLOOKUP to return the first number:



          =IF(I1<>"",VLOOKUP(I1,A:B,2,FALSE),"")


          ![![enter image description here






          share|improve this answer














          Use a helper column. In that column put the following formula:



          =IF(B1=0,"n/a",SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))


          This will return a single number based on the rankings.



          ![enter image description here



          Then in your output column use:



          =IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")


          ![![enter image description here



          Then a simple VLOOKUP to return the first number:



          =IF(I1<>"",VLOOKUP(I1,A:B,2,FALSE),"")


          ![![enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 9 at 17:24

























          answered Nov 9 at 16:53









          Scott Craner

          87k82449




          87k82449












          • I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
            – Daniel Sachs
            Nov 10 at 2:13












          • I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
            – Daniel Sachs
            Nov 10 at 11:46




















          • I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
            – Daniel Sachs
            Nov 10 at 2:13












          • I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
            – Daniel Sachs
            Nov 10 at 11:46


















          I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
          – Daniel Sachs
          Nov 10 at 2:13






          I figured I would need a helper column but couldn't think of what it would be. Turning the values into a decimal is such a clever and simple solution. This is great, however I am still having 1 problem with this part. '=IFERROR(INDEX(A:A,MATCH(LARGE(F:F,ROW(1:1)),F:F,0)),"")' If the results are a tie to the very end it will return the same name multiple times. When changing the values so that Andy and Dane both have 1.123, it will rank Andy twice. link
          – Daniel Sachs
          Nov 10 at 2:13














          I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
          – Daniel Sachs
          Nov 10 at 11:46






          I have found a solution to the problem where I was returning the same name multiple times in case of a tie. I thought I would share it in case someone could use it in the future. I changed the first formula to =IF(B1=0,"n/a",SUM(-.0000000001*ROW(),SUMPRODUCT(B1:E1/10^(COLUMN(B1:E1)-MIN(COLUMN(B1:E1)))))) This way it adds a small value to the results but not enough to change the rankings. Probably not the most elegant solution but it seems to work. Thank you Scott Craner for getting me this far
          – Daniel Sachs
          Nov 10 at 11:46




















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53229737%2fdynamically-sort-list-based-off-associated-values-with-tie-breaker-values%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Schultheiß

          Liste der Kulturdenkmale in Wilsdruff

          Android Play Services Check