Benford's law - Generalization to digits beyond the first -- Is there a VBA solution?

Juggler_IN

Active Member
Joined
Nov 19, 2014
Messages
358
Office Version
  1. 2003 or older
Platform
  1. Windows
I am looking for a VBA led output for 2nd, 3rd, 4th, etc, (Generalization to digits beyond the first).

The refrence link is : Benford's law - Wikipedia

Essentially the formula to code is below the text "And the probability that d (d = 0, 1, ..., 9) is encountered as the n-th (n > 1) digit is"

Thanks
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
To replicate the table,

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][td="bgcolor:#C0C0C0"]
B​
[/td][td="bgcolor:#C0C0C0"]
C​
[/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
E​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][td="bgcolor:#C0C0C0"]
I​
[/td][td="bgcolor:#C0C0C0"]
J​
[/td][td="bgcolor:#C0C0C0"]
K​
[/td][td="bgcolor:#C0C0C0"]
L​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
5​
[/td][td="bgcolor:#F3F3F3"]
Pos\Digit
[/td][td]
0​
[/td][td]
1​
[/td][td]
2​
[/td][td]
3​
[/td][td]
4​
[/td][td]
5​
[/td][td]
6​
[/td][td]
7​
[/td][td]
8​
[/td][td]
9​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
1​
[/td][td="bgcolor:#CCFFCC"]
n/a​
[/td][td="bgcolor:#CCFFCC"]
30.10%​
[/td][td="bgcolor:#CCFFCC"]
17.61%​
[/td][td="bgcolor:#CCFFCC"]
12.49%​
[/td][td="bgcolor:#CCFFCC"]
9.69%​
[/td][td="bgcolor:#CCFFCC"]
7.92%​
[/td][td="bgcolor:#CCFFCC"]
6.69%​
[/td][td="bgcolor:#CCFFCC"]
5.80%​
[/td][td="bgcolor:#CCFFCC"]
5.12%​
[/td][td="bgcolor:#CCFFCC"]
4.58%​
[/td][td="bgcolor:#CCFFCC"]C6: =LOG(1 + 1/C$5)[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
2​
[/td][td="bgcolor:#FFFFCC"]
11.97%​
[/td][td="bgcolor:#FFFFCC"]
11.39%​
[/td][td="bgcolor:#FFFFCC"]
10.88%​
[/td][td="bgcolor:#FFFFCC"]
10.43%​
[/td][td="bgcolor:#FFFFCC"]
10.03%​
[/td][td="bgcolor:#FFFFCC"]
9.67%​
[/td][td="bgcolor:#FFFFCC"]
9.34%​
[/td][td="bgcolor:#FFFFCC"]
9.04%​
[/td][td="bgcolor:#FFFFCC"]
8.76%​
[/td][td="bgcolor:#FFFFCC"]
8.50%​
[/td][td="bgcolor:#FFFFCC"]B7: =SUMPRODUCT(LOG(1 + 1/(10*ROW(INDIRECT(10^($A7-2) & ":" & 10^($A7-1) - 1)) + B$5)))[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td]
3​
[/td][td="bgcolor:#FFFFCC"]
10.18%​
[/td][td="bgcolor:#FFFFCC"]
10.14%​
[/td][td="bgcolor:#FFFFCC"]
10.10%​
[/td][td="bgcolor:#FFFFCC"]
10.06%​
[/td][td="bgcolor:#FFFFCC"]
10.02%​
[/td][td="bgcolor:#FFFFCC"]
9.98%​
[/td][td="bgcolor:#FFFFCC"]
9.94%​
[/td][td="bgcolor:#FFFFCC"]
9.90%​
[/td][td="bgcolor:#FFFFCC"]
9.86%​
[/td][td="bgcolor:#FFFFCC"]
9.83%​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td]
4​
[/td][td="bgcolor:#FFFFCC"]
10.02%​
[/td][td="bgcolor:#FFFFCC"]
10.01%​
[/td][td="bgcolor:#FFFFCC"]
10.01%​
[/td][td="bgcolor:#FFFFCC"]
10.01%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
9.99%​
[/td][td="bgcolor:#FFFFCC"]
9.99%​
[/td][td="bgcolor:#FFFFCC"]
9.99%​
[/td][td="bgcolor:#FFFFCC"]
9.98%​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td]
5​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td="bgcolor:#FFFFCC"]
10.00%​
[/td][td][/td][/tr]
[/table]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top