使用公式将基数10转换为基数36

有没有一种简单的方法来在Excel中将数字从基数10转换为基数36? 我有一个超过2000个数字的列表,我需要转换,所以我不能在一个在线转换器中一个一个地做。

我在想,即使有一个math的方法来做这件事,我可以使用一个公式。

更好的解决scheme是使用BASE函数

=基地(转换的数量,基地)

例如

=基数(35,36)= Z

=基数(36,36)= 10

看看这个:

http://www.thetropicalevents.com/Xnumbers60/
http://www.thetropicalevents.com/Xnumbers60.htm

[增加了Korem要求的代码]

要么

Sub main() Dim base10Number As Double base10Number = Int(Rnd * 1000) Debug.Print base10Number, ConvertBase10(base10Number, "0123456789ABCDEF") End Sub Public Function ConvertBase10(ByVal d As Double, ByVal sNewBaseDigits As String) As String Dim S As String, tmp As Double, i As Integer, lastI As Integer Dim BaseSize As Integer BaseSize = Len(sNewBaseDigits) Do While Val(d) <> 0 tmp = d i = 0 Do While tmp >= BaseSize i = i + 1 tmp = tmp / BaseSize Loop If i <> lastI - 1 And lastI <> 0 Then S = S & String(lastI - i - 1, Left(sNewBaseDigits, 1)) 'get the zero digits inside the number tmp = Int(tmp) 'truncate decimals S = S + Mid(sNewBaseDigits, tmp + 1, 1) d = d - tmp * (BaseSize ^ i) lastI = i Loop S = S & String(i, Left(sNewBaseDigits, 1)) 'get the zero digits at the end of the number ConvertBase10 = S End Function 

复制从http://www.freevbcode.com/ShowCode.asp?ID=6604

或类似…

 =ConvertBase10(A1,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") Sub main() Dim MyNumber As Double MyNumber = 999999999999999# MsgBox MyNumber & ": " & ConvertBase10(MyNumber, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ") End Sub Public Function ConvertBase10(ByVal d As Double, ByVal sNewBaseDigits As String) As String Dim S As String, tmp As Double, i As Integer, lastI As Integer Dim BaseSize As Integer BaseSize = Len(sNewBaseDigits) Do While Val(d) <> 0 tmp = d i = 0 Do While tmp >= BaseSize i = i + 1 tmp = tmp / BaseSize Loop If i <> lastI - 1 And lastI <> 0 Then S = S & String(lastI - i - 1, Left(sNewBaseDigits, 1)) 'get the zero digits inside the number tmp = Int(tmp) 'truncate decimals S = S + Mid(sNewBaseDigits, tmp + 1, 1) d = d - tmp * (BaseSize ^ i) lastI = i Loop S = S & String(i, Left(sNewBaseDigits, 1)) 'get the zero digits at the end of the number ConvertBase10 = S End Function 

已从https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.excel.worksheet.functions/yY7U_kX_FwU复&#x5236;