-
Percentages
I have an idea although I do not know how to excute it. I have 8 labels as follows:
Below Basic: 0, Basic: 0, Proficient: 0, Advance: 0
"0-49" "50-79" "80-95" "96-100"
Now I have the following data:
John Smith 50
Jane Doe 81
Person 3 30
Person 4 99
How can I get the data to check to see what category it falls under and add to the appropriate place?
-
Re: Percentages
Extract the last value of the label caption using InStr() & Mid$() or even use Split().
For John Smith, compare 50 to see if <= that extracted value
Another option is to store the high value of each label in its TAG property. The compare values to it, i.e., If 50 <= Val(Label1.Tag)
-
Re: Percentages
Here is one example. To make the data easy to access for the demo I'm loading it into a list box and pumping the results out to a message box.
Code:
Private Sub Command1_Click()
Dim intRanking(3) As Integer
Dim i As Integer
Dim x As Integer
Dim strLine() As String
Dim strValue As String
For i = 0 To List1.ListCount - 1
strLine = Split(List1.List(i), " ")
strValue = strLine(UBound(strLine))
Select Case Val(strValue)
Case Is < 50
x = 0
Case Is < 80
x = 1
Case Is < 96
x = 2
Case Else
x = 3
End Select
intRanking(x) = intRanking(x) + 1
Next i
MsgBox "Below Basic: " & intRanking(0) & vbCrLf & _
"Basic: " & intRanking(1) & vbCrLf & _
"Proficient: " & intRanking(2) & vbCrLf & _
"Advance: " & intRanking(3)
End Sub
Private Sub Form_Load()
List1.AddItem "John Smith 50"
List1.AddItem "Jane Doe 81"
List1.AddItem "Person 3 30"
List1.AddItem "Person 4 99"
List1.AddItem "Person 5 42"
List1.AddItem "Person 6 87"
End Sub