Converting Between Number Systems

Problem

You need to convert numbers between number systems, for example, from hexadecimal to decimal.

Solution

Use Excel's number system conversion functions such as HEX2DEC and DEC2HEX.

Discussion

When debugging software, I use the heck out of hexadecimal to decimal (and vice versa) conversions. Excel makes such conversions easy with its HEX2DEC and DEC2HEX functions.

The syntax for HEX2DEC is =HEX2DEC(n), where n is the hexadecimal to be converted. For example, the formula =HEX2DEC("1F0CC3") returns the decimal value 2,034,883.

Conversions from decimal to hexadecimal use the syntax DEC2HEX(n, digits), where n is the hexadecimal to be converted and digits is the number of characters to use for the resulting hexadecimal number. For example, the formula =DEC2HEX(64000,8) returns the hexadecimal value 0000FA00, whereas =DEC2HEX(64000,4) returns FA00.

See Also

Excel also supports conversions to and from the binary and octal systems. For example, OCT2HEX converts a number from octal to hexadecimal and DEC2BIN converts a decimal number to binary. Check out the Excel help topic "Engineering Functions" for more information on these other number system conversion functions.

Using Excel

Getting Acquainted with Visual Basic for Applications

Collecting and Cleaning Up Data

Charting

Statistical Analysis

Time Series Analysis

Mathematical Functions

Curve Fitting and Regression

Solving Equations

Numerical Integration and Differentiation

Solving Ordinary Differential Equations

Solving Partial Differential Equations

Performing Optimization Analyses in Excel

Introduction to Financial Calculations

Index



Excel Scientific and Engineering Cookbook
Excel Scientific and Engineering Cookbook (Cookbooks (OReilly))
ISBN: 0596008791
EAN: 2147483647
Year: N/A
Pages: 206
Authors: David M Bourg

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net