Here is a function that will do that.
What you will need to do first is create the module for the code.
Go to Tools -> Macro -> Visual Basic Editor
Then go to Insert -> Module from that screen.
Now, paste the following code into the main editor window
Function ConvertBase(ByVal intNumberToConvert As Integer, ByVal intBase) As String
Dim strOutput As String
Dim intDigit As Integer
Dim strDigit As String
Dim blnNegative As Boolean
' We run out of letters if trying to convert to a base > 36 so don't let the user do it
If intBase > 36 Then
ConvertBase = 0
Exit Function
End If
If intNumberToConvert < 0 Then
intNumberToConvert = -1 * intNumberToConvert
blnNegative = True
End If
While intNumberToConvert <> 0
intDigit = intNumberToConvert Mod intBase
If intDigit <= 9 Then
strDigit = Str$(intDigit)
Else
strDigit = Chr$(intDigit + 55)
End If
intNumberToConvert = (intNumberToConvert - intDigit) / intBase
strOutput = Trim(strDigit) & strOutput
Wend
If blnNegative Then
strOutput = "-" & strOutput
End If
ConvertBase = strOutput
End Function
You will then have a function that you can call from Excel in the following way:
=ConvertBase (A1,k)
will convert cell A1 to base k.
At the minute it assumes that all input is in base 10.
Hope this helps
