t87843.ods (23.4 KB)
Many users apply centered formatting which makes text visually indistinguishable from numbers as shown in columns G and H.
First column A has constant numbers in unformatted cells.
B has the corresponding hex values from Dec2Hex in unformatted cells. Spreadsheets can not calculate with hex numbers. Hex values are text. There are no more than 3 data types number, text and error values returned from formulas. Dates are day numbers, times are fractions of days, currencies are just plain decimals, TRUE equals 1, FALSE equals 0.
The text in column C is formatted with a user-defined number format as suggested by @erAck. This is one of the rare cases where a number format makes sense with text values. It makes the hex strings distinguishable by an additional “0x” prefix, however you should be aware that the values in columns B and C are identical although the are displayed differently. See test in column E. Number formats change only the appearance of a cell value.
The in column D is a concatenation of the string “0x” with the result of Dec2Hex. This actual text is identical to the displayed text. Column D is not identical to the equally looking text in column C. See test in column F.
Unformatted cells show numbers right-aligned and text right-aligned which makes them visually distinguishable.
Every Calc user should know about menu:View>“Highlight Values” [Ctrl+F8] which displays numbers in blue, text in black and formula results in green font.
P.S. I would prefer the concatenated text “0x42” over the formatted text “42” displayed as “0x42” because it is very unusual and irritating when a text value lies about itself.