Brian Dunning's FileMaker Custom Functions

Alpha2Int ( Alpha )

Converts Alpha string to its integral equivalent

  Average rating: 4.3 (32 votes) Log in to vote

JT Hughes   JT Hughes
Queuedom
http://notapplicable.com

Share on Facebook Share on Twitter

  Sample input:
Alpha2Int ( "ABC" )
  Sample output:
731

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

// SAMPLE CONVERSION FOR Alpha = "ABC"

// FIRST ITERATION

// Alpha = "ABC"
// Integer => Position ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; "A" ; 0 ; 1 ) * 26 ^ ( 3 - 1 ) = 1 * 26 ^ 2 = 676

// SECOND ITERATION

// Alpha => "BC"
// Integer +=> Position ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; "B" ; 0 ; 1 ) * 26 ^ ( 2 - 1 ) = 2 * 26 ^ 1 = 52

// THIRD ITERATION

// Alpha = "C"
// Integer +=> Position ( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; "C" ; 0 ; 1 ) * 26 ^ ( 1 - 1 ) = 3 * 26 ^ 0 = 3

// Integer = 676 + 52 + 3 = 731

 

Comments

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.