I have the following code as a sub in Excel 2010:

```
i = 2

For j = 1 To num_scenarios

Dim probdiff As Double
Dim OCS_Spend As Double
n = 0

For k = 1 To num_yrs

' These are the calculations and potentially not relevant to my question but here for context    
For Each cell In rng

x = Rnd()
'Debug.Print Format(x, "0.00000%")
If cell.Value >= x Then

'Populate the result sheet

Sheets("Event Occurs").Cells(i, 1) = mywksht.Cells(cell.Row, 1)
Sheets("Event Occurs").Cells(i, 2) = mywksht.Cells(cell.Row, 2)
Sheets("Event Occurs").Cells(i, 3) = mywksht.Cells(cell.Row, 3)
Sheets("Event Occurs").Cells(i, 4) = mywksht.Cells(cell.Row, 4)
Sheets("Event Occurs").Cells(i, 5) = mywksht.Cells(cell.Row, 5)
Sheets("Event Occurs").Cells(i, 6) = mywksht.Cells(cell.Row, 6)
Sheets("Event Occurs").Cells(i, 10) = "Event Occurs"
Sheets("Event Occurs").Cells(i, 11) = mywksht.Cells(cell.Row, 11)
Sheets("Event Occurs").Cells(i, 9) = x
Sheets("Event Occurs").Cells(i, 7) = k
Sheets("Event Occurs").Cells(i, 8) = j
Sheets("Event Occurs").Cells(i, 14) = (cell.Value - x) ^ (2)
event_max = Sheets("Event Occurs").Cells(i, 11)
probdiff = probdiff + (cell.Value - x) ^ (2)

If Round(cell / x, 0) >= event_max Then
    Sheets("Event Occurs").Cells(i, 12) = event_max
    Else
        Sheets("Event Occurs").Cells(i, 12) = Round(cell / x, 0)
End If
Duration = Sheets("Event Occurs").Cells(i, 4)
Num_Event = Sheets("Event Occurs").Cells(i, 12)
Spend = Sheets("Event Occurs").Cells(i, 5)
Sheets("Event Occurs").Cells(i, 13) = Num_Event * Spend / Duration
OCS_Spend = OCS_Spend + Num_Event * Spend / Duration

n = n + 1
i = i + 1

End If

Next cell

' End calculations

Next k

Debug.Print j, probdiff / n

probdiff = 0
OCS_Spend = 0
Next j

```

The output to the immediate window looks like this:

```
 J:               MSE:
 1             0.194236476623154 
 2             0.157939130921924 
 3             0.19825548826238 
 4             0.384990330451172 
 5             0.267128221022187 

```

The first column is j (the outer for loop) and represents a scenario. The second column is the mean square error of the data generated by each iteration of the outer j loop. So 1 is the first time the loop runs,2 is the second etc.. The smaller the number in column MSE, the more likely the scenario is to occur.

I want people to be able to limit the number of scenarios (j's) they see to only the most likely in the event they want to run 100 scenarios. So I need a way of sorting the table above to something like this

```
j:                MSE        
2             0.157939130921924 
1             0.194236476623154 
3             0.19825548826238 
5             0.267128221022187
4             0.384990330451172 

```

And if someone wanted to see only the top three results, it would be this:

```
j:                MSE        
2             0.157939130921924 
1             0.194236476623154 
3             0.19825548826238 

```

So basically the three most likely out of 5 possible scenarios. I have tried collections and arrays but not dicitonaries (I am still learning how to use these and not sure if they exists in Excel VBA).