问题
Formatting a value to display units adds clarity while retaining the numerical value in the cell. This can be done using:
=TEXT(1000,"#,### kW")
or via the formatting dialog: Format Cells > Number > Category Custom
But some characters are not allowed by either method. How can this be done for units like "kWh" or "kWh/yr" without converting the value to a text type and thereby preventing the value from being used in a calculation?
回答1:
Either enclose your string within quotes, or "escape" each character
eg: #,### \k\W\h
or: #,### "kWh"
(works either as a custom number format, or as the format argument for the TEXT
function)
EDIT: Because of the question from @SOlsen, I will add that if you use the quoted format within the text function, you will need to double-up on the included quotes.
来源:https://stackoverflow.com/questions/63401591/formatting-numbers-with-prohibited-characters