Jump to content

This topic is 8764 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi

Does anyone have a calculation up their sleeve that will convert a numeric value into hexadecimal? I've tried myself with a combination of built-in functions, but I'm not very good at math so it never comes out right.

Thanks

Posted

Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16/16/16),16), 1) &

Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16/16),16), 1) &

Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16),16), 1) &

Middle("0123456789ABCDEF", 1+Mod(DecNum,16), 1)

... where DecNum is the decimal number you want to convert. This will handle up to 65535 decimal or FFFF hex. If you need more digits, just append more terms on the beginning of the calculation. Add an additional /16 for each one.

[This message has been edited by BobWeaver (edited February 02, 2001).]

Posted

(((Position("0123456789ABCDEF", Upper(Middle(HexNum, 1, 1)), 1, 1)-1)*16+

Position("0123456789ABCDEF", Upper(Middle(HexNum, 2, 1)), 1, 1)-1)*16+

Position("0123456789ABCDEF", Upper(Middle(HexNum, 3, 1)), 1, 1)-1)*16+

Position("0123456789ABCDEF", Upper(Middle(HexNum, 4, 1)), 1, 1)-1

This topic is 8764 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.