Formatting numbers with prohibited characters

一曲冷凌霜 提交于 2021-02-11 13:27:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!