Engineering All versions ◉ 28 views

=DEC2HEX()

Converts a decimal number to hexadecimal.

Applies To: Excel for Microsoft 365Excel for Microsoft 365 for MacExcel 2024Excel 2024 for MacExcel 2021Excel 2021 for MacExcel 2019Excel 2016
=DEC2HEX(number, [places])
Hover argument names in the table for details.
Output typeNumber/Text
Popularity17 / 100
VolatileNo
Dynamic ArrayNo
Download sample .xlsx ▦ Try in Playground Dedicated file for this function — safe & lightweight · sample data + live formulas
Share:

⬇ Download Sample Workbook

A dedicated .xlsx for =DEC2HEX() with Persian sample data & live formulas — open in Excel and practice.

  • Sheet “Sample” — data table + formula in place
  • Sheet “Guide” — syntax, arguments & tips from this page
  • Instant & secure (token + rate limit)
Download DEC2HEX.xlsx ~ 8–12 KB · No macros

⇪ Share

Send this function to friends

Quiz this function

%d questions — syntax, example & errors — test yourself!

◧ Arguments

ArgumentTypeRequiredDescription
number 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 Number 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).

▣ Examples

Converts decimal value 100 to hexadecimal with 4 characters ("padded" with two leading zeros). =DEC2HEX(100, 4)
Result: 0064
Converts decimal value -54 to hexadecimal =DEC2HEX(-54)
Result: FFFFFFFFCA
Converts decimal value 28 to hexadecimal. =DEC2HEX(28)
Result: 1C
Returns the #NUM! error value because the result (40) requires 2 character places. =DEC2HEX(64,1)
Result: #NUM!

§ 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.

✦ Tips

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

⚠ Common Errors

#NUM! If Number is < -549,755,813,888 or if Number is > 549,755,813,887, DEC2HEX returns the #NUM! error value. If the result of DEC2HEX requires more than the number of specified Places characters, it returns the #NUM! error value. If Places is negative, DEC2HEX returns the #NUM! error value.
Fix: An allowed number
#VALUE! If Number is non-numeric, DEC2HEX returns the #VALUE! error value. If Places is non-numeric, DEC2HEX returns the #VALUE! error value.
Fix: برای Number و Places مقدار عددی وارد کنید.

💬 Comments & Q&A 0 approved

🔒 Your comment will be published after review.

Share your thoughts — visible after admin approval

No comments yet — be the first!

✍️ Add comment / question

captcha
🔒 Your comment will be published after review.