34 lines
882 B
Plaintext
34 lines
882 B
Plaintext
SEDOLCHECKSUM
|
|
=LAMBDA(s,
|
|
IF(6 = LEN(s),
|
|
LET(
|
|
cs, MID(s, SEQUENCE(1, 6, 1, 1), 1),
|
|
isVowel, LAMBDA(c,
|
|
ELEM(c)({"A","E","I","O","U"})
|
|
),
|
|
sedolValue, LAMBDA(c,
|
|
LET(
|
|
ic, CODE(c),
|
|
IF(65 > ic,
|
|
ic - 48,
|
|
(ic + 10) - 65
|
|
)
|
|
)
|
|
),
|
|
IF(OR(isVowel(cs)),
|
|
" -> Invalid vowel in SEDOL string",
|
|
MOD(
|
|
10 - MOD(
|
|
SUM(
|
|
MUL({1,3,1,7,3,9})(
|
|
sedolValue(cs)
|
|
)
|
|
), 10
|
|
), 10
|
|
)
|
|
)
|
|
),
|
|
"Expected a 6-character SEDOL"
|
|
)
|
|
)
|