List numbers by their quantity

timetabler

New Member
Joined
Jun 15, 2010
Messages
27
I am using 'small' / 'large' to give a rank order of students, such that students are ranked according to their test score, which works well.

However, we can only award a limited number of grades to each class, therefore, once I have ranked ordered the class, (it does this dynamically), I need to allocate their grades. (my class in this example has 8 students and below are the grades that I can award).

I have a table with the available grades and quantities:
[TABLE="width: 300"]
<tbody>[TR]
[TD]5 (Row)[/TD]
[TD]F (Grade Value)[/TD]
[TD]G (Quantity)[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]9[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]8[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]7[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]6[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]5[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]4[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]3[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]2[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]15[/TD]
[TD]U[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]


Please can I have suggestions as to how to (best / simply) list the grades in a column such that they are displayed as, there are two grade 8s and 2 grade 2s?

[TABLE="width: 150"]
<tbody>[TR]
[TD]Grades[/TD]
[/TR]
[TR]
[TD]9[/TD]
[/TR]
[TR]
[TD]8[/TD]
[/TR]
[TR]
[TD]8[/TD]
[/TR]
[TR]
[TD]7[/TD]
[/TR]
[TR]
[TD]6[/TD]
[/TR]
[TR]
[TD]4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[/TR]
</tbody>[/TABLE]

Kind Regards
James
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
If your data is in "F & " G" column, then Results from code in Column "H".
Code:
[COLOR="Navy"]Sub[/COLOR] MG08Jan28
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, c [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] n [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Set[/COLOR] Rng = Range("F2", Range("F" & Rows.Count).End(xlUp))
c = 1
Cells(c, "H") = "Grades"
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
    [COLOR="Navy"]If[/COLOR] Dn.Offset(, 1).Value > 0 [COLOR="Navy"]Then[/COLOR]
        [COLOR="Navy"]For[/COLOR] n = 1 To Dn.Offset(, 1)
            c = c + 1
            Cells(c, "H") = Dn
        [COLOR="Navy"]Next[/COLOR] n
    [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top