title: Why my If condition is returning wrong result?
body: <p>I'm a student currently studying VBA in one of my classes, where the current assignment is to pull data from a .txt file and display it, as well as total it, and then grade the total. using arrays I've been successful in the first two parts using arrays, but when trying to factor in the total for a grade the array only takes the starting numbers into account. Any thoughts? Code below</p>
  
  <pre><code>Sub Categories()
  
  Dim Locale As String, State(1 To 50) As Variant
  Dim Serial(1 To 50) As Single, i As Single
  Dim path As String, j As Single
  Dim Score(1 To 50, 1 To 7) As Single
  Dim IndexGrade(1 To 50) As Single
  Dim Total(1 To 50) As Single
  Locale = ActiveWorkbook.path
  
  path = Locale &amp; "US_States.txt"
  
  Open path For Input As #1
  
  For i = 1 To 50 Step 1
      Input #1, Serial(i), State(i)
      Sheet1.Cells(1 + i, 1).Value = Serial(i)
      Sheet1.Cells(1 + i, 2).Value = State(i)
           For j = 1 To 7 Step 1
              Input #1, Score(i, j)
              Total(i) = Total(i) + Score(i, j)
              Sheet1.Cells(1 + i, 3).Value = Total(i)
          Next j
     Total(i) = Sheet1.Cells(1 + i, 3).Value
     If 0 &lt;= Total(i) &lt; 100 Then
      Sheet1.Cells(1 + i, 4).Value = "A"
      ElseIf 100 &lt;= Total(i) &lt; 200 Then
      Sheet1.Cells(1 + i, 4).Value = "B"
      ElseIf 200 &lt;= Total(i) &lt; 300 Then
      Sheet1.Cells(1 + i, 4).Value = "C"
      ElseIf 300 &lt;= Total(i) Then
      Sheet1.Cells(1 + i, 4).Value = "D"
      End If
  Next i
  
  Close #1
  
  End Sub
  </code></pre>