Converting to Other Number Systems

Written by Allen Wyatt (last updated March 27, 2021)
This tip applies to Excel 2013, 2016, 2019, and Excel in Microsoft 365


4

Dennis regularly needs to convert decimal values into other number systems, such as base 6 or base 24. Excel makes it easy to convert to binary or octal, as there are built-in functions for that. Dennis wonders if there is a way to convert to other number systems, however.

The functions that Dennis refers to for common conversions are DEC2BIN, DEC2OCT, and DEC2HEX. These convert decimal values to, respectively, binary, octal, and hexadecimal. If you want to convert a decimal value to an entirely different number system, then the easiest way is to use the BASE function. This function uses the following syntax:

=BASE(value, base)

In this usage, value would be the decimal number you want to convert and base would be the numbering system desired. (The value you use for base must be between 2 and 36, inclusive.) As an example, if Dennis wanted to convert 123,456 to base 24, he could use the following:

=BASE(123456,24)

The result returned by the function is 8M80. The BASE function always returns a string as its result. You can also, if you'd like, add an optional third parameter to the function which indicates how many digits you want returned. Here's an example:

=BASE(123456,24,6)

The result returned is 008M80, which is six digits with leading zeroes.

The BASE function was introduced with the advent of Excel 2013, so it is available in all the newer versions of the program.

Remember that BASE returns a string, which means that you cannot use what is returned in formulas. You can, however, use a number in a different base in a formula if you first convert it to a decimal value. You do this with the DECIMAL function (also introduced in Excel 2013) which requires two parameters: a string containing the value in the other numbering system and the base used for that value. Thus, to convert 8M80 (base 24) into decimal, you could use the following:

=DECIMAL("8M80",24)

If you use a base designation that doesn't make sense given the value in the first parameter, then the function returns a #NUM! error.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (13840) applies to Microsoft Excel 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Converting from Relative to Absolute

Addresses used in a formula can be either relative or absolute. If you need to switch between the two types of ...

Discover More

Controlling Footnote Placement

Footnotes are normally placed at the bottom of the page on which the footnote is referenced. However, Word provides some ...

Discover More

Fixing Odd Sorting Behavior

When you sort data that contains both numbers and text, you may not get exactly the result that you expected. To know ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Returning Blanks with VLOOKUP

Normally the VLOOKUP function returns a value, and if it can't return a value it returns a zero. Here's how you can use ...

Discover More

Specifying a Date Range in a SUMIFS Formula

The SUMIFS function allows you to specify criteria by which values can be included in a sum. Putting together the ...

Discover More

Returning Item Codes Instead of Item Names

The data validation capabilities of Excel are really handy when you want to limit what is put into a cell. However, you ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2021-03-27 11:06:40

Allen

Ha! You are correct; that was a typo which I've now fixed. (Thank you for bringing it to my attention, Tomas.)

-Allen


2021-03-27 10:52:04

Tomas

Allen,
But in your example on how to convert back to decimal you write "to convert 8M80 (base 6)". Just a small typo, I guess.

/Tomas


2021-03-27 10:48:56

Allen

Tomas, you are correct. That's why the tip indicates it is base 24.

-Allen


2021-03-27 05:35:12

Tomas

This is a great tip.
Not that it really matter, but 8M80 can not be in base 6 (it must be at least base 23).


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.