Other - Example 7
Other - Example 7 Benford's Law Fraud detectionDownloads First digits lawSite Map
Home Page | Population | Sampling | Fraud | Other | Tutorial | Macros
Other - Example 7
Sub Example7()
'
' obtain totals
' for the column "paidamt" for provider numbers starting with 30
' file is read and then
' the file totals are shown on the Excel status bar
' this is the starting point for more complex examples
Dim ofile As New cNFile
'Dim sbuffer As String
'Dim i As Integer
Dim sMsg As String
Dim sText As String
Dim dTotals As Double
Dim icol As Integer
Dim sTextName As String
Dim iPaidAmountColumn As Integer
Dim iProviderNumberColumn As Integer
Dim sFormattedNumber As String
Dim sCondition As String
Dim d As Double

Application.Cursor = xlWait
ofile.Filename = BASEDIR & "clmdenbp.txt"
sTextName = "paidamt"
Call ofile.OpenFile
iPaidAmountColumn = ofile.getcolno("paidamt")
iProviderNumberColumn = ofile.getcolno("billprov")
'
' total paid amounts for provider numbers beginning with 3404
'
sCondition = "$paidamt < 100"
ofile.Infix = sCondition
Do While ofile.EOF = False
Call ofile.GetRow
If ofile.IsSelected Then
sText = ofile.getcol(iPaidAmountColumn)
If IsNumeric(sText) Then
dTotals = dTotals + CDbl(sText)
End If
End If
'sText = ofile.getcol(iPaidAmountColumn)
'If IsNumeric(sText) Then
' d = CDbl(sText)
' If d < 100 Then dTotals = dTotals + d
'End If

Loop
Set ofile = Nothing
sFormattedNumber = Format(dTotals, "###,###,###.00")
Application.StatusBar = "Ex7: File totals for " & sTextName & ": " & sFormattedNumber
Application.Cursor = xlDefault
End Sub



 

 

 

 

Main Page

Complete Auditor resources
Links | Privacy Policy | FAQ | Downloads | Trademarks
Web Page last updated on 04-20-2008
© EZ-R Stats, LLC 2005-2007