EZ TuitionsAll tuitions

Convert a Number to Hexadecimal with BASE in Google Sheets

BASE returns text in a chosen number base. Try two Google examples that use base 16, hexadecimal. The second also asks for a minimum text length, so its result starts with zeroes.

Prepare two empty practice cells

Use your own permitted Google Sheets spreadsheet on a computer. Confirm the account, file, sheet tab and editing permission. Inspect G1 and G2 and use them only if both are known empty.

If either cell contains work, stop before typing. Do not delete or overwrite it. Ask the owner if the file, tab, permission or empty cells are uncertain.

Convert 255 to hexadecimal text

  1. Click the known empty G1.
  2. Type =BASE(255, 16) and press Enter when done.
  3. Compare the result with Google's published result: FF.

The first argument is the decimal number to convert. The second, 16, selects the output base. The returned FF is text in that base, not a new decimal number to total.

Read the leading zeroes in a six-character result

  1. Click the known empty G2.
  2. Type =BASE(4095, 16, 6) and press Enter when done.
  3. Compare the whole result with 000FFF, including all three leading zeroes.

This example changes the input number to 4095 and sets a minimum length of 6. Google documents padding on the left with zeroes to reach the requested minimum length. It is not a cell-number-format setting.

These are two separate published examples, not a controlled comparison where only the third argument changes. Do not infer other conversions from this pair.

If a formula returns an error, a different result or an unexpected prompt, stop and compare it with the source. Do not replace it with the expected text to force agreement.

Stop at reading the result

Google documents a value that is an integer greater than or equal to zero and a base that is an integer from 2 to 36. This exercise uses only the two literal hexadecimal examples above.

Keep the returned text separate from later arithmetic. Google warns that calculations need to account for the base. This guide does not demonstrate combining results with other formulas, binary arithmetic, negative inputs or non-integer inputs.

A matching result is a check of this practice example, not proof of an assignment or a grade. Nothing here submits the spreadsheet.

Common questions

What does BASE return?

BASE converts a decimal number to a text representation in another base. In these examples, the second argument 16 selects hexadecimal.

What does the optional third argument do?

It sets the minimum length of the returned text. Google documents adding zeroes on the left when the result needs padding to reach that length.

What should the two example cells show?

Google publishes =BASE(255, 16) with FF and =BASE(4095, 16, 6) with 000FFF. Keep the leading zeroes when comparing the second result.

Can I calculate with the returned text as if it were decimal?

Do not assume that. Google warns that later calculations must account for the non-decimal base. This practice ends at reading the returned text, without further arithmetic.

Sources

Checked . Google publishes both formulas and results. Empty-cell, permission and stop rules are precautions for this practice; this page does not claim a hands-on Sheets session.