J-Walk posted about Benford’s law and I thought I’d test it out. I found an Excel file with a lot of numbers, namely a price list. In a new workbook, I put the following code:
Dim wb As Workbook
Dim ws As Worksheet
Dim rCell As Range
Set wb = Workbooks(“Internal Price List 4 2 09.xls”)
For Each ws In wb.Worksheets
For Each rCell In ws.UsedRange
If IsNumeric(rCell.Value) Then
Sheet1.Cells(Sheet1.Rows.Count, 1).End(xlUp).Offset(1, 0).Value = rCell.Value
This created a list of the 1,372 numbers. I deleted the five numbers that were less than 1. John didn’t have any zeros on his chart, and for five numbers it wasn’t worth dealing with.
Not quite the smooth distribution I expected. The table on the right is the distribution of the right-most number. I just wanted to see how it would look. I expected it to be fairly even except I expected 9 to be higher since they’re prices.