用禁止的字符格式化数字 [英] Formatting numbers with prohibited characters

查看:41
本文介绍了用禁止的字符格式化数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将值格式化为显示单位可以增加清晰度,同时将数值保留在单元格中.可以使用:

Formatting a value to display units adds clarity while retaining the numerical value in the cell. This can be done using:

= TEXT(1000,#,### kW")

或通过格式对话框:设置单元格格式>编号>类别自定义

但是任何一种方法都不允许某些字符.对于像"kWh"这样的单位,该如何做到呢?或"kWh/yr";而不将值转换为文本类型,从而防止在计算中使用该值?

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?

推荐答案

要么将您的字符串用引号引起来,要么用转义"将其括起来.每个字符

Either enclose your string within quotes, or "escape" each character

例如:#,### \ k \ W \ h

或:#,###"kWh"

(可以用作自定义数字格式,也可以用作 TEXT 函数的格式参数)

(works either as a custom number format, or as the format argument for the TEXT function)

编辑:由于@SOlsen的问题,我要补充一点,如果您在文本函数中使用带引号的格式,则需要加倍包含的引号.

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.

这篇关于用禁止的字符格式化数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆