lordrom said:works up to 8, but 9 should be 100 in base 3. your formula returns 30, which is illegal in base 3
Book1 | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | 100 | 9 | ||||
Sheet1 |
lordrom said:exactly what i'm after
cheers
now, where do i find morefunc? i trust it will cost?
lordrom said:works up to 8, but 9 should be 100 in base 3. your formula returns 30, which is illegal in base 3
Andrew Poulsom said:lordrom said:works up to 8, but 9 should be 100 in base 3. your formula returns 30, which is illegal in base 3
I'd better go back to school!
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