changing base

lordrom

New Member
Joined
Oct 20, 2003
Messages
3
i am looking to convert base 10 numbers into base 3. i know there are functions to move between 2, 8, 10 and 16 but can excel handle base 3.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
works up to 8, but 9 should be 100 in base 3. your formula returns 30, which is illegal in base 3
 
Upvote 0
That's the problem. It involves iteration so I don't think it can be done with standard Excel funtions. Here is a UDF I found:

Code:
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
 
Upvote 0

Forum statistics

Threads
1,213,539
Messages
6,114,221
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top