简体   繁体   English

为什么当我使用“=”符号将日期值插入到 Excel 中的另一个单元格时,日期格式会发生变化?

[英]Why date format gets changed when I insert a date value into another cell in excel by using the '=' sign?

想象一个单元格 A1 的日期为 22-06-2022 在单元格 B1 中我输入这个 =“”“”&A1&“””” 我得到的结果是“44735”而不是“22-06-2022”

It is because the B1 cell doesn't have a 'Date' format, only the A1 cell has it.这是因为 B1 单元格没有“日期”格式,只有 A1 单元格有它。 B1 cell only has the number value of the cell. B1 单元格只有单元格的数值。

See Date systems in Excel (1900 system) .请参阅Excel 中的日期系统(1900 系统)

When you enter a date, it is converted into a serial number that represents the number of days elapsed since January 1, 1900. For example, if you enter July 5, 2011, Excel converts the date to the serial number 40729.输入日期时,它会转换为表示自 1900 年 1 月 1 日以来经过的天数的序列号。例如,如果输入 2011 年 7 月 5 日,Excel 会将日期转换为序列号 40729。

When you see the number 44735 as 22-06-2022 in A1 , this means that the cell is formatted as DD-MM-YYYY (you can check this by selecting the cell and clicking Ctrl + 1 ).当您在A1看到数字4473522-06-2022时,这意味着单元格的格式为DD-MM-YYYY (您可以通过选择单元格并单击Ctrl + 1来检查这一点)。

So, instead of =A1 (returning: 44735 as an integer), you could use =TEXT(A1,"DD-MM-YY") to produce the same string from the value in a different cell.因此,您可以使用=TEXT(A1,"DD-MM-YY")从不同单元格中的值生成相同的字符串,而不是=A1 (返回:44735 作为整数)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM