I have grades for students and levels of proficiency.
for example, for 5th grade, there are four levels of proficiency. The four levels of proficiency correspond to letters of the alphabet, so if a 5th grader got a letter assignment of B, then his proficiency level would be “Below Proficient” since for any letter in A to R would get a level of “Below Proficient” I was wondering how to do this with cases,
My rough idea of code was the following:
Function ConvertScores(Grade, Letter_Score)
Select Case ConvertScore(5, like "[A-R]")
Case ConvertScore(5, like"
ConvertScores = "F & P Remedial"
Case 2
ConvertScores = "F & P Below Proficient"
Case 3
ConvertScores = "F & P Proficient"
Case 4
ConvertScores = "F & P Advanced"
End Function
So yea, I wish VBA had a list object, what is the list object in VBA?
EDIT: I was able to do it with multiple If statements, but it seems to me that cases would have been a better way to go.
Here is my code that I want to use with cases instead of multiple if-thens
Function ConvertScoresMOY(Grade, Letter_Score) As String
If Grade = "5" And Letter_Score Like "[A-R]" Then
ConvertScoresMOY = "F & P Remedial"
ElseIf Grade = "5" And Letter_Score Like "[S-T]" Then
ConvertScoresMOY = "F & P Below Proficient"
ElseIf Grade = "5" And Letter_Score Like "[U-V]" Then
ConvertScoresMOY = "F & P Proficient"
ElseIf Grade = "5" And Letter_Score Like "[W-Z]" Then
ConvertScoresMOY = "F & P Advanced"
Else:
End If
End Function
Lets just start from insert all the conditions in one simple condition:
If Grade = "5" Then
End If
then you can use SWITCH CASE:
Select Case Letter_Score
Case Letter_Score Like "[A-R]"
ConvertScoresMOY = "F & P Remedial"
Case val Letter_Score Like "[S-T]"
ConvertScoresMOY = "F & P Below Proficient"
End Select
Answer:
You could create your dictionary in another sheet, then use the VLOOKUP() function to search for a value on the first column and get the value on the second.