Microsoft Office Tutorials and References

In Depth Information

**Chapter 20: Some Really Cool Functions**

In other words, in base 10 you count up through ten digits in one position

before moving one position to the left for the next significant digit. And then

the first position cycles back to the beginning digit. To make it simple, you

count 0 to 9, and then add a 1 to the next significant digit, and start the first

position over at 0, and therefore 10 comes after 9.

Binary, octal, and hexadecimal each count up to a different digit before

incrementing the next significant digit. Binary only has two values — 0 and 1.

That’s why when any larger base number, such as a base 10 number, is

converted to binary, there are more actual digit places. Look at what happens to

the number 20. In base 10, 20 is represented in 2 digits. In binary, 20 is

represented in 5 digits.

Octal, based on powers of 8, counts up to 8 digits — 0 through 7. The digits 8

and 9 are never used in octal. Hexadecimal, based on powers of 16, counts

up to 16 digits, but how? What is left after 9? The letters of the alphabet,

that’s what!

Hexadecimal uses these digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. The

letters A through F represent the decimal values 10 through 15, respectively.

If you have ever worked on the colors for a website, you might know that

FFFFFF is all white. The web server recognizes colors represented in

hexadecimal notation and responds appropriately.

The number 200 in decimal notation becomes C8 in hexadecimal notation.

The number 99 in decimal notation becomes 63 in hexadecimal notation.

The point to all this is that there are a group of functions to do all these

conversions. These functions take into account all combinations of conversion

between binary, octal, decimal, and hexadecimal. These functions are

Function

What It Does

Converts binary to decimal

BIN2DEC

BIN2HEX

Converts binary to hexadecimal

BIN2OCT

Converts binary to octal

DEC2BIN

Converts decimal to binary

DEC2HEX

Converts decimal to hexadecimal

Converts decimal to octal

DEC2OCT

Converts hexadecimal to binary

HEX2BIN

Converts hexadecimal to decimal

HEX2DEC

Converts hexadecimal to octal

HEX2OCT

OCT2BIN

Converts octal to binary

OCT2DEC

Converts octal to decimal

OCT2HEX

Converts octal to hexadecimal