# Thread: Still Stuck On A loop

1. Hi,

The 10 value is what I was aiming for, which is the absolute value of the wrong counts. Right now, my code has it calculating the +/- difference. I tried using the absolute function (which worked for percentages) but not for counts. Sorry for late reply i went camping over the weekend.

2. try:
```Sub AudErrQuant2()
'This functions calculates error int and counts
With Worksheets("Generalized Report")
For x = 6 To 10001
If Sheets("Detail Report").Range("E" & x) = "Audit Error" Then
RowNo = Range(Sheets("Detail Report").Range("A" & x)).Row
.Range("A4").Value = .Range("A4").Value + Abs(Worksheets("Contract").Cells(RowNo, "G").Value - Worksheets("As Built").Cells(RowNo, "G").Value)
.Range("B4").Value = .Range("B4").Value + Abs(Worksheets("Contract").Cells(RowNo, "I").Value - Worksheets("As Built").Cells(RowNo, "I").Value)
.Range("C4").Value = .Range("C4").Value + Abs(Worksheets("Contract").Cells(RowNo, "J").Value - Worksheets("As Built").Cells(RowNo, "J").Value)
.Range("D4").Value = .Range("D4").Value + Abs(Worksheets("Contract").Cells(RowNo, "K").Value - Worksheets("As Built").Cells(RowNo, "K").Value)
End If
Next x
End With 'Worksheets("Generalized Report")
End Sub```

3. I see the difference in counts between mine and yours. Was my code calculating the +/- difference?

4. Originally Posted by NWE
Was my code calculating the +/- difference?
Yes.

5. Ok then, lessons learned. Thank you for ALL of your help sir!