Dim cs() As String = { "指标1", "指标2","指标3","指标4","指标5","指标6","指标7","指标8","指标9","指标10","指标11","指标12","指标13","指标14","指标15" ," 指标16","指标17","指标18","指标19" }
For Each c As String In cs
Dim ndr As DataRow = DataTables("变动").AddNew
ndr("指标") = c
For i As Integer = 0 To Tables("变中").Rows.Count - 1
Dim r1 As Row = Tables("变中").Rows(i)
Dim r2 As Row = Tables("变后").Rows(i)
Dim result As Double = (r2(c)-r1(c)) / r1(c)
If result <= -1 Then
ndr("小于负1") += 1
ElseIf result < 0 And result > -1 Then
ndr("负1到0") += 1
ElseIf result = 0 Then
ndr("等于0") += 1
ElseIf result < 1 And result > 0Then
ndr("从0到1") += 1
ElseIf result >=1 Then
ndr("大于1") += 1
End If
Next
Next
提示:索引 97 不是为负数,就是大于行数。
不知道哪里错了