# A challenge for the community - MPAN Algorithm - Can you translate one of these into the relevant formula for Quickbase?

• 0
• Question
• Updated 3 years ago

Trying to get the most efficient solution for this

https://en.wikipedia.org/wiki/Meter_Point_Administration_Number#Check_Digit  (there are other solutions below when you click "Show" on that link)

It's using Mod formula and several Mid functions, but I thought I would throw this out into the community for a little challenge...

• 0 Points

Posted 3 years ago

• 0

Ⲇanom the ultimate (Dan Diebolt), Champion

• 30,064 Points
If you have represented the first 12 Core fields as one digit text fields the formula for the 13'th Core text field should be this:

var Number Sum = (
3 * ToNumber([Core01]) +
5 * ToNumber([Core02]) +
7 * ToNumber([Core03]) +
13 * ToNumber([Core04]) +
17 * ToNumber([Core05]) +
19 * ToNumber([Core06]) +
23 * ToNumber([Core07]) +
29 * ToNumber([Core08]) +
31 * ToNumber([Core09]) +
37 * ToNumber([Core10]) +
41 * ToNumber([Core11]) +
43 * ToNumber([Core12])
);

ToText(Mod(Mod(\$Sum, 11), 10))

FWIW, the formulas in the Wiki article verify a given check digit as their output - they do not calculate the check digit as their output.
• 0 Points
Excellent.  Thank you, Dandiebolt.  Well done.

I hadn't split out the core fields, but I'll do that via a Mid formula.  Thanks again.