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:
5 (Row)F (Grade Value)G (Quantity)
691
782
871
961
1050
1141
1230
1322
1410
15U0

<tbody>
</tbody>


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?

Grades
9
8
8
7
6
4
2
2

<tbody>
</tbody>

Kind Regards
James
 

Some videos you may like

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,233
Messages
5,594,964
Members
413,955
Latest member
FalcoDaz

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
Top