BASE Function in Excel is a very interesting type of Mathematical Function. We use the Decimal Number System to represent numbers using the digits from 0 to 9. The base of the Decimal Number system is 10. This logic would help you better understand the BASE Function.
So here we go.
- When to Use the BASE Function in Excel?
- What is the Base of the Number System?
- Syntax and Arguments
- Examples to Learn the Base Function in Excel
- Left Padding the Result with Zeroes
- Important Notes for BASE Function
When to Use the BASE Function in Excel?
If BASE Function could be defined in a single line, then BASE Function converts a numerical value into its value in a specified base ( radix ). The BASE Function returns the text representation of any number converted to a particular base.
The numbers we use in real life have a base of 10 because we represented them using the digits from 0 to 9 ( 10 digits ).
What is the Base of the Number System?
Base refers to the number of digits that we can use to represent a number. For instance, when we say that we can use the digits from 0 to 9 to write any number, we mean that those numbers would have a base of 10 ( total digits from 0 to 9 ).
We can understand this with one more example. If we want to write a number using only 4 digits ( 0 to 3 ) then the base of the number would be 4. In this case, we can only use a combination of digits from 0 to 3 to represent any number. i.e (321)4, (203)4
A computer only understands Binary language. With Binary, we mean the base of all the numbers would be 2 and we can use only 2 digits ( 0 and 1 ) to represent any number. i.e. (1011)2, (1100)2
Now, the BASE Function converts a numerical value ( having base 10 ) into the specified base value.
Syntax and Arguments
The following points contain information regarding the BASE Function of Excel.
- number – This is the numerical value whose radix we want to change. Its value lies between 0 and 253
- radix – This is the new base for our numerical value. radix must be an integer such that it lies between 2 and 36 ( including 2 and 36 ). If the base is n, then the result of the BASE function would be a combination of digits from 0 to (n-1) digits.
- [min_length] – This is the minimum length of our result. If the length of result is smaller than min_length then the result is left padded with zeroes. It is an optional argument.
Examples to Learn the Base Function in Excel
In this section of the blog, we would execute some examples to implement the BASE Function in Excel.
Example 1 – Simplest Example to Learn BASE Function
Let us suppose we want to change the base of 1924 ( base 10 ) to base 4. We can use the BASE Function Formula to get results.
Use the following BASE Formula.
As a result, the formula has returned 132010.
Explanation – We have supplied the number and radix argument of the BASE Function as 1924 and 4 respectively. So the number 1924 is converted to base 4. The result is 132010 ( use of digits from 0 to 4 only ).
Example 2 – Decimal to Binary Number Conversion
The Base of the Binary number system is 2 which means that it uses only 2 digits 0 and 1 to represent all digits that can be represented using the decimal number system.
Let us suppose we have the following numerical values ( default base is 10 ) in the range A2:A10.
Use the following formula in cell B2 to get the numbers converted into Binary Number System.
Select the range B2:B10 and press the Ctrl D key.
As a result, the formula converts the numbers into binary values.
Explanation – We have supplied cell A2 ( containing 24 ) as the BASE Function number argument. The radix is supplied as 2. As a result, the formula returned the base 2 value of 23 as 11000.
Example 3 – Base Greater than 10
Let us suppose we want to convert 324 into base 12.
Use the following BASE Formula.
As a result, the formula returns 1A61.
Explanation – For a Base greater than 10, the use of characters in the representation of numbers is totally valid, For Base 12 we can use a total of 12 characters:-
- Digits from 0 to 9 ( 10 ) and
- Alphabets A and B ( 2 )
Where 0 to 9 are the numbers and A represents 10, B represents 11.
Left Padding the Result with Zeroes
Let us say we need to convert 12 into a binary number system. Use the following formula,
The formula returns 1100. We want this result to have 6 digits in total. So, update the formula to:-
Since the result was 1100, the formula has left padded the two empty spaces with zeroes to make the result of length 6.
Explanation – We have supplied the min_length optional argument as 6.
Important Notes for BASE Function
This is the very essential information for the BASE Function defined below.
- The BASE Function results in a #NUM! error for non-numerical arguments.
- If the number argument is not an integer, then the digits after decimal would be truncated.
- The number, radix and num_length argument must lie under specified values.
This brings us to the end of the blog.
Thank you for coming.