Formualizer Docs

BIN2HEX

Converts a binary text value to hexadecimal text.

Optionally pads the output with leading zeros using places.

The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.

Syntax

=BIN2HEX(number, [places])

Arguments

ArgumentTypeRequiredDefault
numbernumberRequired—
placesnumberOptional—

Return type

Can return text.

Remarks

  • Input must be a binary string up to 10 digits; 10-digit values may be signed.
  • Signed binary values are converted using two's-complement semantics.
  • places must be at least the output width and at most 10, or #NUM! is returned.

Examples

Convert a binary value using the shortest output.

Formula =BIN2HEX("1010")

Expected result A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Ask for five output places, padding on the left.

Formula =BIN2HEX("1010",5)

Expected result 0000A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Convert zero with a one-place width.

Formula =BIN2HEX("0",1)

Expected result 0

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

The input contains a digit outside base two.

Formula =BIN2HEX("102")

Expected result #NUM!

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

Pad hexadecimal output

Formula =BIN2HEX("1010",4)

Expected result 000A

Try this formula

This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.

FAQ

Does BIN2HEX preserve signed binary meaning?

Yes. A 10-bit binary with leading 1 is interpreted as signed and converted using two's-complement semantics.

Implementation

Engine source

On this page