Brian Dunning's FileMaker Custom Functions

NumToHex ( integer )

Convert Base 10 number to Base 16

  Average rating: 4.1 (42 votes) Log in to vote

Jeremiah Small   Jeremiah Small
Soliant Consulting, Inc.
https://www.soliantconsulting.com

Share on Facebook Share on Twitter

  Sample input:
NumToHex ( 3440 )
  Sample output:
D70

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

To convert a base 10 number to hexadecimal you repeatedly divide the number by 16, each time recording the remainder. At the end of this line up all of the remainders and reverse their order. As you know, hexadecimal is base 16, and hence makes use of 6 extra symbols (ABCDEF). A = 10, and F, 15. 16 is written as 10. When converting to any base above 10 a remainder equal to or greater than 10 has to be written using the correct symbol.

Similar to

Example:
Converting 3440 to hexadecimal

3440/16 = 215 (Mod = 0dec or 0hex)
215/16 = 13 (Mod = 7dec or 7hex)
13/16 = 0 (Mod = 13dec or Dhex)

In reverse order, the hex reads D70

Hence, 3440dec = D70hex

 

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.