Finance

Charts

Statistics

Macros

Search

How to use the DEC2HEX() function in Excel

Its converts a decimal number to its hexadecimal (base-16) equivalent using two’s complement notation.

Syntax
DEC2HEX(number; [places])

Arguments

  • number (required)
    • Decimal integer to convert (range: -549,755,813,888 to +549,755,813,887)
    • Non-integers are truncated (decimal places ignored)
    • Negative values return 10-digit two’s complement hexadecimal
  • places (optional)
    • Minimum number of hexadecimal digits to display
    • Adds leading zeros for positive numbers
    • Has no effect on negative numbers (always 10 digits)
    • Decimal places are truncated if specified

Technical Background
The conversion uses two’s complement representation for negative values. For complete number system theory, see the « Number Systems » introduction section.

Examples

=DEC2HEX(14)       // Returns « 0E »

Key Specifications

  • Input Range: -549,755,813,888 to 549,755,813,887
  • Output Characteristics:
    • Positive: Variable length (1-10 hex digits)
    • Negative: Always 10 hex digits
    • Letter digits (A-F) appear in uppercase
  • Special Handling:
    • Negative numbers ignore places parameter
    • Fractional values are truncated

Common Applications

  • Memory address representation
  • Color code manipulation
  • Cryptographic operations
  • Low-level system programming

Error Conditions

  • Returns #NUM! error when:
    • Number < -549,755,813,888
    • Number > 549,755,813,887
    • Places < required digits for positive numbers
  • Returns #VALUE! for non-numeric inputs
0 0 votes
Évaluation de l'article
S’abonner
Notification pour
guest
0 Commentaires
Le plus ancien
Le plus récent Le plus populaire
Online comments
Show all comments
Facebook
Twitter
LinkedIn
WhatsApp
Email
Print
0
We’d love to hear your thoughts — please leave a commentx