Hello All,

So I am still struggling on getting the right answers for my loops. There are 2 pages that comprise the conditional loop. A Page called Detail Report and an As Built Page. The Detail Report, In column E contains the following answers: "Audit Error" and " Detail Error" and "". In Column C, contains things such as "PR Code". In column A or B, it contains an address to the cell that was marked in Column C.I would like the following loop to fulfill the following condition. If Column C says "PR Code" OR If Column L on "As Built" sheets = Column E on Detail report (either which would fulfill the condition), add up the numbers for those cells only from column I only. For example, if there are 3 matches found, it should only add up the corresponding numbers in column I for those matches. However my loops seem to add up random numbers, or multiply things by two or subtract 1 from the right answer etc. So any help on making this consistent would be appreciated. I feel like either I am using the wrong math function or I am still not isolating the cells correctly.

Sub PrError()
'This functions calculates pr qty if pr code is not a match. 


For x = 1 To 10001
    If Sheets("Detail Report").Range("C" & x) = "PR Code" Then
   
    On Error Resume Next
    splt = Split(Sheets("Detail Report").Range("A" & x), "")
    fnd = splt(2)




        If Sheets("As Built").Range("L" & fnd) = "Found" Then
            Worksheets("Generalized Report").Range("C16").Value = Worksheets("Generalized Report").Range("C16").Value + WorksheetFunction.Sum(Worksheets("As Built").Range("I" & x).Value)
        End If
    End If
Next x
End Sub