简体   繁体   中英

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 cell only has the number value of the cell.

See Date systems in Excel (1900 system) .

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.

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 ).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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