Excel 数字格式:什么是“[$-409]"? [英] Excel Number Format: What is "[$-409]"?
问题描述
我正在自动化 excel,使用宏系统作为我应该通过自动化做什么的指南.当我将一列格式化为日期时,宏为该列生成了一个 NumberFormat
:
i'm automating excel, using the macro system as a guide to what i should do through automation. When i format a column as a date, the macro generated a NumberFormat
for the column to be:
[$-409]m/d/yy h:mm AM/PM;@
我正在尝试解读这到底意味着什么.我收集从谷歌搜索,方括号中的值是一个条件",如果条件:
i'm trying to decipher what this really means. i gather from googling, that the values in the square brackets are a "condition", and that if the condition:
$-409
满足,那么它将使用 NumberFormat
is met, then it will use the NumberFormat
m/d/yy h:mm AM/PM
如果不是,则使用 NumberFormat
@
我找到的参考资料说数字格式@"是一个文本占位符
The references i find say that the number format "@" is a Text Placeholder
所以我的问题是:
什么是条件 $-409 测试?它是否与-409(即负四百零九)进行比较,如果是,它所比较的美元符号是什么?
What is the conditional $-409 testing? Is it comparing something against -409 (i.e. negative four hundred and nine), and if so, what is the dollar sign it's comparing against?
如果条件失败,它求助于文本占位符at-sign",它显示什么?
If the conditional fails, and it resorts to the Text Placeholder "at-sign", what does it show as?
推荐答案
澄清其他人所说的:
[$-409] 是一个 locale 代码,以十六进制给出.使用特定区域设置代码作为日期前缀决定了使用各种日期时间格式代码时显示的内容.例如使用日期
The [$-409] is a locale code, given in hexadecimal. Prefixing a date with a certain locale code determines what is shown when you use the various date time format codes. For example using the date
1973 年 11 月 28 日上午 11:28:13
November 28, 1973 11:28:13 AM
以下表为例:
Format Code 409 (English United States) 804 (Chinese PRC)
=========== =========================== =================
m 11 11
mm 11 11
mmm Nov 十一月
mmmm November 十一月
d 27 27
dd 27 27
ddd Mon 二
dddd Monday 星期二
y 73 73
yy 73 73
yyy 1973 1973
yyyy 1973 1973
AM/PM AM 上午
所以最终相同的格式代码用两个不同的语言环境标识符,给出了不同的结果:
So in the end the same format code with two different locale identifiers, gives different results:
[$-409]mmmm dd yyyy h:mm AM/PM
November 27 1973 11:28 AM
[$-804]mmmm dd yyyy h:mm AM/PM
十一月 27 1973 11:28 上午
因为查找语言环境代码列表就像拔牙一样,这里有一些参考:
Since finding a list of locale codes is like pulling teeth, here are some references:
语言标识符常量和字符串(主要来源,archive.is)
按区域设置排序的 Windows 区域设置代码 (
按区域设置排序的 Windows 区域设置代码 (archive.org, archive.is)
这篇关于Excel 数字格式:什么是“[$-409]"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!