Fix Incorrect Excel DEC2HEX Results from Calculated Values
Question details
The user needs Excel to convert a calculated decimal value to the expected hexadecimal result.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A calculated value is passed to DEC2HEX for hexadecimal conversion.
- Observed behavior
- A value displayed as 704 may be stored slightly below 704, causing DEC2HEX to truncate it and return an unexpected result.
Identify the formula that produces the decimal value and confirm whether it should represent a whole number. Increasing the displayed decimal places can help you inspect the result, but formatting does not change the underlying value.
Round the calculated value before using DEC2HEX
Use explicit rounding when a calculation should produce a whole number but floating-point precision leaves it slightly below that value.
DEC2HEX truncates a non-integer input. If the intended value is a whole number, rounding it to zero decimal places before conversion prevents a tiny precision difference from changing the result.
Select the cell containing the DEC2HEX formula and inspect its input in the formula bar.
Wrap the calculated input in ROUND. For example, replace =DEC2HEX(C3*32) with =DEC2HEX(ROUND(C3*32,0)).
Press Enter and verify that the result matches the intended integer. For example, 704 converts to 2C0, while 703 converts to 2BF.

Round values before DEC2HEX in WPS Spreadsheet
Open your workbook in WPS Spreadsheet and use ROUND with DEC2HEX to convert an intended whole number to hexadecimal.
- 1. Open the workbook: Open WPS Spreadsheet and use Open to select your Excel workbook.
- 2. Edit the formula: Select the cell with the conversion formula and enter =DEC2HEX(ROUND(C3*32,0)) in the formula bar, adjusting the cell reference and calculation as needed.
- 3. Verify and save: Press Enter to check the hexadecimal result, then use File > Save to save the workbook.

Frequently Asked Questions
Why does DEC2HEX return 2BF when the cell displays 704?
The underlying value may be slightly below 704 even though the cell displays 704. DEC2HEX truncates that input to 703, which converts to 2BF. If 704 is the intended integer, use =DEC2HEX(ROUND(A1,0)).
Will changing the number format fix the conversion?
No. Changing decimal places through the cell's number formatting changes only the display. Use ROUND in the calculation or DEC2HEX input to change the value passed to the function.
Should I use FLOOR instead of ROUND?
Use ROUND when you need to correct a small precision difference around an intended value. FLOOR rounds down according to its significance argument, so it can produce a different result and is not a reliable fix for this issue.
What if my calculated value is meant to have decimals?
Decide how the fractional value should be handled before conversion. DEC2HEX truncates non-integer inputs, while ROUND(value,0) rounds to the nearest integer and may change the intended result.




