MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Function setthepercentage(ByVal thegoals As List(Of Integer), ByVal thename As String) As String Dim over05 As Integer = 0 Dim over15 As Integer = 0 Dim over25 As Integer = 0 Dim countelements As Integer = 0 'work out if it is 0.5 - 1,3,4,5,3,2,4,5, For Each element As String In thegoals 'chekc if over 0.5 countelements = countelements + 1 If element > 0 Then over05 = over05 + 1 'check if over 1.5 ElseIf element > 1 Then over15 = over05 + 1 'check if over 2.5 ElseIf element > 2 Then over25 = over05 + 1 End If Next over05 = (over05 / countelements) * 100 If over05 <> "NaN" Then Session(thename & "over05") = over05 End If over15 = (over15 / countelements) * 100 If over15 <> "NaN" Then Session(thename & "over15") = over15 End If over25 = (over25 / countelements) * 100 If over25 <> "NaN" Then Session(thename & "over25") = over25 End If End Function
I also count how many times it goes through a loop so
If element > 0 Then over05 = over05 + 1 end if
this give me the numbers to work with so:
countelements = countelements + 1
over05 = (over05 / countelements) * 100
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.