On 2002-04-08 20:48, youbet7469 wrote:

Dear group... Can anyone tell me how to program formulas into excel to count in bases other than 10. (i.e. base six would be 1,2,3,4,5,6,11,12,13,14,15,16,21)

Ideally I'd like to be able to work with all the different bases up through 22..

Any advice would be greatly appreciated.

Thanks

Greg

One way is to use this UDF

Press Alt F11

Click > Insert > Module

Paste this code in.

Function BaseConv(InputNum, BaseNum)

Dim Quotient, Remainder As Single

Dim Answer As String

Quotient = InputNum ' Set quotient to number to convert.

Remainder = InputNum ' Set remainder to number to convert.

Answer = ""

Do While Quotient <> 0 ' Loop while quotient is not zero.

' Store the remainder of the quotient divided by base number in a

' variable called remainder.

Remainder = Quotient Mod BaseNum

' Reset quotient variable to the integer value of the quotient

' divided by base number.

Quotient = Int(Quotient / BaseNum)

' Reset answer to contain remainder and the previous answer.

Answer = Remainder & Answer

' Convert answer variable to a number.

Loop

BaseConv = Val(Answer)

End Function

Just refernce it as a Std formula in your

workbook As

=BaseConv(256,19)

Just a word of caution...it uses loops which

can be a little slow depending on the base

and the number of formulas you have in your

worksheet....

_________________

Kind Regards,

Ivan F Moala

http://<font color="green"><a href="...r Construction

[ This Message was edited by: Ivan F Moala on 2002-04-08 21:24 ]

## Like this thread? Share it with others