Hello,
I hope that I can find some help here. I would like to build a utility using Excel that will allocate representatives among several states using the Huntington Hill Method. I have already done so, in fact, but it is cumbersome and I would like scalability. I believe that both problems can be solved using the byrow and Lambda tools.
The most important part of the HH method is that it applies a recursive quotient to each state, evaluating the impact of adding an additional representative to that state's delegation. The state with the highest quotient gets that representative, which changes that state's total delegates, so that the calculation must be run all over again before the next representative can be assigned.
My current build of the utility has each state assigned a row and each representative assigned a column. The first columns, equal in number to the number of states, are given over to assigning each state a representative, since every state gets at least one. I then paste the quotient formula in all of the subsequent cells of the array. Each column has a cell at the top which finds the maximum quotient value among the states below it, and adds another representative to that state's total.
I don't like how many cells it takes up. I have 64 states and over 1,000 representatives. I also don't like how I will have to alter the array itself when I want to change the number of states or of representatives. I believe I should be able to create a list which expands or contracts to an input number of states -- that part I think I can handle. But I believe that I should also be able to set one cell as an input for the number of representatives total to be assigned, and another cell with a formula that uses byrow and Lambda to do all the heavy lifting. I think that formula can be made to 1) assign one representative to each state, 2) evaluate each state's need to be assigned an additional representative, 3) assign that representative to the state's total delegation, and 4) run that process again and again until the total number of delegates assigned between all the states matches the input.
Am I wrong? If it can be done, could someone help me with the syntax?
Thanks for reading. Thanks in advance for any help you can provide.
I hope that I can find some help here. I would like to build a utility using Excel that will allocate representatives among several states using the Huntington Hill Method. I have already done so, in fact, but it is cumbersome and I would like scalability. I believe that both problems can be solved using the byrow and Lambda tools.
The most important part of the HH method is that it applies a recursive quotient to each state, evaluating the impact of adding an additional representative to that state's delegation. The state with the highest quotient gets that representative, which changes that state's total delegates, so that the calculation must be run all over again before the next representative can be assigned.
My current build of the utility has each state assigned a row and each representative assigned a column. The first columns, equal in number to the number of states, are given over to assigning each state a representative, since every state gets at least one. I then paste the quotient formula in all of the subsequent cells of the array. Each column has a cell at the top which finds the maximum quotient value among the states below it, and adds another representative to that state's total.
I don't like how many cells it takes up. I have 64 states and over 1,000 representatives. I also don't like how I will have to alter the array itself when I want to change the number of states or of representatives. I believe I should be able to create a list which expands or contracts to an input number of states -- that part I think I can handle. But I believe that I should also be able to set one cell as an input for the number of representatives total to be assigned, and another cell with a formula that uses byrow and Lambda to do all the heavy lifting. I think that formula can be made to 1) assign one representative to each state, 2) evaluate each state's need to be assigned an additional representative, 3) assign that representative to the state's total delegation, and 4) run that process again and again until the total number of delegates assigned between all the states matches the input.
Am I wrong? If it can be done, could someone help me with the syntax?
Thanks for reading. Thanks in advance for any help you can provide.