Convert to hex excel

Excel для Microsoft 365 Excel для Microsoft 365 для Mac Excel для Интернета Excel 2021 Excel 2021 для Mac Excel 2019 Excel 2019 для Mac Excel 2016 Excel 2016 для Mac Excel 2013 Excel 2010 Excel 2007 Excel для Mac 2011 Excel Starter 2010 Еще…Меньше

В этой статье описаны синтаксис формулы и использование функции ДЕС.В.ШЕСТН в Microsoft Excel.

Описание

Преобразует десятичное число в шестнадцатеричное.

Синтаксис

ДЕС.В.ШЕСТН(число;[разрядность])

Аргументы функции ДЕС.В.ШЕСТН описаны ниже.

  • Число    — обязательный аргумент. Преобразуемое десятичное число. Если оно отрицательное, то разрядность игнорируется и функция ДЕС.В.ШЕСТН возвращает 10-значное (40-битное) шестнадцатеричное число, в котором самый старший бит является знаковым битом. Остальные 39 бит являются битами значения. Отрицательные числа представляются в дополнительных кодах.

  • Разрядность    Необязательный. Количество знаков в записи числа. Если разрядность опущена, функция ДЕС.В.ШЕСТН использует минимально необходимое количество знаков. Разрядность используется, чтобы приписать возвращаемому значению ведущие нули.

Замечания

  • Если число < -549 755 813 888 или число > 549 755 813 887, то DEC2HEX возвращает #NUM! значение ошибки #ЗНАЧ!.

  • Если число не является числом, то DEC2HEX возвращает #VALUE! значение ошибки #ЗНАЧ!.

  • Если для результата DEC2HEX требуется больше количества знаков Знаков знаков Знаков после заданного числа знаков Знаков после заданного числа знаков, возвращается #NUM! значение ошибки #ЗНАЧ!.
    Например, DEC2HEX(64;1) возвращает значение ошибки, так как для результата (40) требуется два знака.

  • Если значение аргумента «разрядность» не является целым числом, оно усекается.

  • Если число не является числом, то DEC2HEX возвращает #VALUE! значение ошибки #ЗНАЧ!.

  • Если «количество» отрицательное, то DEC2HEX возвращает #NUM! значение ошибки #ЗНАЧ!.

Пример

Скопируйте образец данных из следующей таблицы и вставьте их в ячейку A1 нового листа Excel. Чтобы отобразить результаты формул, выделите их и нажмите клавишу F2, а затем — клавишу ВВОД. При необходимости измените ширину столбцов, чтобы видеть все данные.

Формула

Описание

Результат

=ДЕС.В.ШЕСТН(100;4)

Преобразует десятичное число 100 в шестнадцатеричное из 4 знаков (с «приписанными» двумя ведущими нулями).

0064

=ДЕС.В.ШЕСТН(-54)

Преобразует десятичное значение -54 в шестнадцатеричное

FFFFFFFFCA

=ДЕС.В.ШЕСТН(28)

Преобразует десятичное значение 28 в шестнадцатеричное.

1C

=ДЕС.В.ШЕСТН(64;1)

Возвращает #NUM! из-за того, что для результата (40) требуется 2 знака.

#ЧИСЛО!

Нужна дополнительная помощь?

Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for the web Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel 2016 Excel 2016 for Mac Excel 2013 Excel 2010 Excel 2007 Excel for Mac 2011 Excel Starter 2010 More…Less

This article describes the formula syntax and usage of the DEC2HEX function in Microsoft Excel.

Description

Converts a decimal number to hexadecimal.

Syntax

DEC2HEX(number, [places])

The DEC2HEX function syntax has the following arguments:

  • Number    Required. The decimal integer you want to convert. If number is negative, places is ignored and DEC2HEX returns a 10-character (40-bit) hexadecimal number in which the most significant bit is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two’s-complement notation.

  • Places    Optional. The number of characters to use. If places is omitted, DEC2HEX uses the minimum number of characters necessary. Places is useful for padding the return value with leading 0s (zeros).

Remarks

  • If Number is < -549,755,813,888 or if Number is > 549,755,813,887, DEC2HEX returns the #NUM! error value.

  • If Number is non-numeric, DEC2HEX returns the #VALUE! error value.

  • If the result of DEC2HEX requires more than the number of specified Places characters, it returns the #NUM! error value.
    For example, DEC2HEX(64,1) returns the error value because the result (40) requires two characters.

  • If Places is not an integer, the value of Places is truncated.

  • If Places is non-numeric, DEC2HEX returns the #VALUE! error value.

  • If Places is negative, DEC2HEX returns the #NUM! error value.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Formula

Description

Result

=DEC2HEX(100, 4)

Converts decimal value 100 to hexadecimal with 4 characters («padded» with two leading zeros).

0064

=DEC2HEX(-54)

Converts decimal value -54 to hexadecimal

FFFFFFFFCA

=DEC2HEX(28)

Converts decimal value 28 to hexadecimal.

1C

=DEC2HEX(64,1)

Returns the #NUM! error value because the result (40) requires 2 character places.

#NUM!

Need more help?

Please Note:
This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Converting to Hexadecimal.

Written by Allen Wyatt (last updated February 15, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003


If you do any programming, you know how important hexadecimal numbers are. Hexadecimal numbers are used to represent values that can be easily understood by both humans and programming languages. In the hexadecimal numbering system, each digit can vary between 0 and F. Thus, 0 through 9 are the same as in our decimal numbering system, and A through F are converted to 10 through 15 in decimal.

How can Excel help with hexadecimal numbers? It includes a worksheet function that allows you to easily convert a number from decimal to hexadecimal. For instance, let’s say you have a decimal value in E3. If you wanted to know the hexadecimal equivalent, you would use the following:

=DEC2HEX(E3)

If the value in E3 was 123, the result of the above formula would be 7B. The DEC2HEX worksheet function can be used to convert any decimal values between -549,755,813,888 and 549,755,813,887.

Once the conversion is done, the value in the cell is considered text. This means that you cannot use the results of DEC2HEX in a numeric formula.

ExcelTips is your source for cost-effective Microsoft Excel training.
This tip (2308) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Converting to Hexadecimal.

Author Bio

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen…

MORE FROM ALLEN

Using AutoComplete Tips

AutoComplete tips are a nice, handy reminder of what you can enter into your document with just a keypress or click. In …

Discover More

Conditional Formats that Distinguish Blanks and Zeroes

Conditional formatting is a great tool. You may need to use this tool to tell the difference between cells that are empty …

Discover More

Adding an Optional Break

The no-width optional break is primarily used for Asian languages in Word. It can have value for English-speakers, as …

Discover More



  • Excel 365


  • Excel 2021


  • Excel 2019


  • Excel 2016




  • February 12, 2022



  • No Comments

It’s unusual to need to work with Hexadecimal values in Excel, but on these rare occasions it can be challenging to figure out how Excel deals with values of this kind. If you simply enter a value like 0xABCDEF78 Excel will treat it as text and won’t recognize it as a numeric value.

What is Hexadecimal?

Hexadecimal (or Hex for short) is a counting system that uses 16 symbols as opposed to the 10 symbols used in the Decimal counting system that we use more often. Hexadecimal uses the letters A-F as well as the numbers 0-9.

Hexadecimal is most often used by computer systems, though it is also used in some advanced mathematical calculations outside of the world of computing.

Converting Hexadecimal values to Decimal in Excel

Excel won’t recognize a Hexadecimal value, but there is a function in its function library that will convert Hexadecimal values into Decimals: the HEX2DEC function.

For example: =HEX2DEC(“FF”) will return 255 – the decimal conversion of the Hexadecimal value FF.

If you’re unfamiliar with Excel functions and formulas you might benefit from our completely free Basic Skills E-book, which will introduce you to the basics of formulas and functions.

Dealing with 0x prefixes

Many programming languages prefix Hexadecimal values with 0x. For example 0xFF instead of just FF.

The HEX2DEC function won’t recognize a Hex value that has a 0x prefix so you will need to strip away the prefixes before you can convert the values.

There are a few different ways you could do this, including Flash Fill, Text To Columns and even Find & Replace, but a formula offers the most long-term solution because it will automatically recalculate. This formula will remove the 0x prefixes:

=RIGHT(A2,LEN(A2)-2)

All of the options mentioned above (as well as the RIGHT and LEN functions) are explained in depth in our Expert Skills Books and E-books.

A working example

You can download an example workbook showing the above functions and formulas in action.

Other counting systems supported by Excel

As well as the HEX2DEC function for Hex values, Excel also contains functions to convert values from Binary (Base 2) and Octal (Base 8) . These are supported by the BIN2DEC and OCT2DEC.

There are also functions to convert each of these counting systems to the other. For example you can convert an Octal value into a Hex value using the OCT2HEX function.

These are the only up-to-date Excel books currently published and includes the new Dynamic Arrays features.

They are also the only books that will teach you absolutely every Excel skill including Power Pivot, OLAP and DAX.

Some of the things you will learn

Share this article

Recent Articles

Leave a Reply

Функция ДЕС.В.ШЕСТН преобразует десятичное число в шестнадцатеричное. Как и большинство функций категории «Инженерные», работает начиная с 2007-й версии Excel.

Описание функции ДЕС.В.ШЕСТН

Преобразует десятичное число в шестнадцатеричное.

Синтаксис

=ДЕС.В.ШЕСТН(число; [разрядность])

Аргументы

числоразрядность

Обязательный аргумент. Преобразуемое десятичное число. Если оно отрицательное, то разрядность игнорируется и функция ДЕС.В.ШЕСТН возвращает 10-значное (40-битное) шестнадцатеричное число, в котором самый старший бит является знаковым битом. Остальные 39 бит являются битами значения. Отрицательные числа представляются в дополнительных кодах.

Необязательный аргумент. Количество знаков в записи числа. Если разрядность опущена, функция ДЕС.В.ШЕСТН использует минимально необходимое количество знаков. Разрядность используется, чтобы приписать возвращаемому значению ведущие нули.

Замечания

  • Число    — обязательный аргумент. Преобразуемое десятичное число. Если оно отрицательное, то разрядность игнорируется и функция ДЕС.В.ШЕСТН возвращает 10-значное (40-битное) шестнадцатеричное число, в котором самый старший бит является знаковым битом. Остальные 39 бит являются битами значения. Отрицательные числа представляются в дополнительных кодах.
  • Разрядность    — необязательный аргумент. Количество знаков в записи числа. Если разрядность опущена, функция ДЕС.В.ШЕСТН использует минимально необходимое количество знаков. Разрядность используется, чтобы приписать возвращаемому значению ведущие нули.

Пример

Дополнительные материалы

Статья по переводу чисел из разных систем счисления

Понравилась статья? Поделить с друзьями:
  • Convert to capital letters in word
  • Convert time to time excel
  • Convert the word doc to pdf
  • Convert the scanned pdf to word
  • Convert the pdf to word online free