You are getting the error because api.Parser.DelimitedParsedValues uses an index, so the first column would be 0, second column would be 1, and the third column would be 2. In your case, you would want the debit position as 1, and the credit as 2 for this api.
Since you can only set the amount to one column, use the debit column. When the debit column is non numeric, you need to set this, api.ValueIsNumeric = True, and then use the credit amount. Otherwise it will skip over the record for being invalid.
If (Not api.ValueIsNumeric AndAlso Not AmountDR = "0") Then
Dim creditColPosition As Integer = 2
'Since the parser already split the entire line, we can just grab the column we want from the parser
Dim amountCR As String = api.Parser.DelimitedParsedValues(creditColPosition)
If (IsNumeric(amountCR) = True) Then
'The parser thinks the debit value is Non-Numeric, since we are now putting in the credit value
'we have to tell the parser that the value is now numeric.
api.ValueIsNumeric = True
Return "-" & amountCR
Else
Return args.value
End If
Else
'Debit value is a number, so just return the debit value
Return args.value
End If