SPREADSHEETS
TUTORIAL
EXAMPLE: AN INTERACTIVE BASE CONVERTER
Rationale
It is often useful to be able to demonstrate
the mechanisms employed in performing number base conversions.
In particular, it is useful to demonstrate base conversion
where complex bases are involved. With bases higher than 10,
the letters A, B, C, D, E, and F are used to represent digits
from 10 to 15.
Tools
The demonstration employs the Microsoft EXCEL application
package. EXCEL has features that can be exploited to execute
this activity. The features employed include using the VLOOKUP
feature to pick the values associated with input digits. The
function POWER(base, positional exponent) is used to consolidate
the position values using the algorithm:
Number
= ådigit_{j }* base ^{positional value of digit}
Methodology
The user is prompted to supply a number
to be converted from a given base into base ten. The base
of the source number is therefore also input interactively
by the user.
The user should enter the number composed
of a maximum of four digits one digit per cell in the set
of cells in columns EFGH. For each of the digits entered,
the application looks up the associated decimal equivalents
taking into account that the base could go up to hexadecimal
or base sixteen. Accordingly, the lookup table has a mapping
for each of the sixteen possible digits 0, 1, ,9, A, ,F.
Tablearray
Digit

Decimal equivalent

0

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

A

10

B

11

C

12

D

13

E

14

F

15

The VLOOKUP function accordingly takes the following shape VLOOKUP(valuetobematched,
tablearrayrange, columnoftargetvalue, k) Where: valuetobematches
the digit entered by the user and in the formula is represented
by the cell address. Tablearrayrange is the range reference
to the lookup table that indicates the decimal equivalent of
each digit. Columnoftargetvalue indicates the column within
the tablearray where the actual values are stored.
Click here to experiment with the application interactively.
