BASE

In this comprehensive guide, we will explore everything you need to know about the BASE formula in Google Sheets. The BASE formula is a powerful function that allows you to convert a number from a decimal (base 10) to another base, such as binary (base 2), octal (base 8), or hexadecimal (base 16). This can be particularly useful when working with computer programming, electronics, or other fields that require different numbering systems.

BASE Syntax

The syntax for the BASE formula in Google Sheets is as follows:



BASE(value, radix, [min_length])

Here's a breakdown of the arguments:

  1. value (required): The decimal number you want to convert to another base.
  2. radix (required): The base you want to convert the number to. This must be an integer between 2 and 36, inclusive.
  3. min_length (optional): The minimum length of the resulting string. If the result has fewer digits than the specified minimum length, it will be padded with leading zeros. If this argument is not provided, the result will not be padded.

BASE Examples

Let's take a look at some examples of how to use the BASE formula in Google Sheets:

  1. Example 1: Converting a decimal number to binary:

Suppose you have the decimal number 10 and you want to convert it to binary (base 2). You can use the following formula:

    =BASE(10, 2)

This will return the binary representation of 10, which is "1010".

  1. Example 2: Converting a decimal number to hexadecimal:

If you have the decimal number 255 and you want to convert it to hexadecimal (base 16), you can use the following formula:

    =BASE(255, 16)

This will return the hexadecimal representation of 255, which is "FF".

  1. Example 3: Converting a decimal number to octal with a minimum length:

Suppose you have the decimal number 63 and you want to convert it to octal (base 8) with a minimum length of 4 digits. You can use the following formula:

    =BASE(63, 8, 4)

This will return the octal representation of 63 with a minimum length of 4 digits, which is "0077".

BASE Tips & Tricks

Here are some tips and tricks to help you get the most out of the BASE formula in Google Sheets:

  1. Remember that the radix argument must be an integer between 2 and 36. If you try to use a value outside of this range, you will get an error.
  2. If you're working with large numbers, keep in mind that Google Sheets has a limit of 30,000 characters per cell. If your result exceeds this limit, you may need to break your calculation into smaller parts or use a different method.
  3. When converting to bases greater than 10, the resulting string will use uppercase letters A-Z to represent digits 10-35. For example, when converting to base 16 (hexadecimal), the digits 10-15 will be represented by the letters A-F.
  4. If you need to convert a number from one non-decimal base to another, you can use a combination of the BASE and DECIMAL functions. First, use the DECIMAL function to convert the number to decimal, and then use the BASE function to convert the decimal number to the desired base.

Common Mistakes When Using BASE

Here are some common mistakes to avoid when using the BASE formula in Google Sheets:

  1. Using a radix value outside of the allowed range (2-36). This will result in an error.
  2. Forgetting to include the radix argument. The BASE function requires both the value and radix arguments to work properly.
  3. Using a non-integer value for the radix or min_length arguments. These arguments must be integers.
  4. Trying to convert a negative number or a number with decimal places. The BASE function only works with positive integers.

Why Isn't My BASE Formula Working?

If your BASE formula isn't working as expected, consider the following troubleshooting steps:

  1. Double-check your formula syntax and make sure you have included all required arguments (value and radix).
  2. Ensure that your radix value is within the allowed range (2-36).
  3. Make sure you are using integer values for the radix and min_length arguments.
  4. Check if the value you are trying to convert is a positive integer. The BASE function does not work with negative numbers or numbers with decimal places.
  5. If you're still having trouble, try breaking down your formula into smaller parts to identify the source of the issue.

BASE: Related Formulae

Here are some related formulae that you may find useful when working with the BASE function in Google Sheets:

  1. DECIMAL: This function converts a number from another base to decimal (base 10). It has the syntax: =DECIMAL(text, radix).
  2. BIN2DEC: This function converts a binary (base 2) number to decimal (base 10). It has the syntax: =BIN2DEC(binary_number).
  3. HEX2DEC: This function converts a hexadecimal (base 16) number to decimal (base 10). It has the syntax: =HEX2DEC(hexadecimal_number).
  4. OCT2DEC: This function converts an octal (base 8) number to decimal (base 10). It has the syntax: =OCT2DEC(octal_number).
  5. DEC2BIN: This function converts a decimal (base 10) number to binary (base 2). It has the syntax: =DEC2BIN(decimal_number, [places]).

With this comprehensive guide, you should now have a solid understanding of the BASE formula in Google Sheets, including its syntax, examples, tips and tricks, common mistakes, troubleshooting, and related formulae. Happy converting!

Move beyond 

Google Sheets

Get started with Causal today.
Build models effortlessly, connect them directly to your data, and share them with interactive dashboards and beautiful visuals.