The `BASE` function in Excel is used to convert a number into a different base system. It converts a decimal number to a text representation of that number in a specified base (radix). The syntax for the `BASE` function is as follows:
BASE(number, radix, [min_length])
Here’s a breakdown of the arguments:
- number: The decimal number you want to convert. It must be a non-negative integer.
- radix: The base you want to convert the number to. This can be any integer between 2 and 36.
- min_length (optional): The minimum length of the returned string. If the converted number is shorter than the specified minimum length, the result will be padded with leading zeros.
Example Usage
- Convert a number to binary (base 2):
To convert the number 10 to binary:
=BASE(10, 2)
This formula returns `1010`.
- Convert a number to hexadecimal (base 16):
To convert the number 255 to hexadecimal:
=BASE(255, 16)
This formula returns `FF`.
- Convert a number to a base with a minimum length:
To convert the number 5 to base 3 with a minimum length of 5 characters:
=BASE(5, 3, 5)
This formula returns `00012`.
Considerations
- The `number` must be non-negative and less than 2^53.
- The `radix` must be between 2 and 36.
- If the specified `min_length` is greater than the length of the converted number, the result will include leading zeros to reach the minimum length.
- The `BASE` function returns a text value. If you need to use the result as a number in calculations, you may need to convert it back using the `VALUE` function or through other means.
This function can be particularly useful for working with different numeral systems, such as binary, octal, or hexadecimal, in various technical and scientific applications.