在Excel文件之间传输日期(不准确) [英] Transferring dates between Excel files (inaccurately)

查看:164
本文介绍了在Excel文件之间传输日期(不准确)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下公式,经常用于将信息从一个文件复制到另一个文件。本质上,它使用给定的ID(A2)并在第二个电子表格中搜索其匹配项,然后从公式的第一部分(在本例中为C)指定的列中复制数据。

  = INDEX([spreadsheet.xlsx] Sheet1!$ C $ 2:$ C $ 50000,MATCH(A2,[spreadsheet.xlsx] Sheet1!$ B $ 2: $ B $ 50000,0))

该公式在所有列上均适用,除非我尝试转移日期。它总是传输比实际日期大4年零1天的日期。我并不总是有这个问题来转移日期,但是我不知道是什么原因造成的。



有什么想法吗?

解决方案

Microsoft 的缩写a>:






Excel支持两种不同的日期系统:



1900年日期系统

在1900年日期系统中,支持的第一天是1900年1月1日。输入日期时,该日期将转换为连续日期代表自1900年1月1日以来经过的天数的数字。例如,如果输入1998年7月5日,Excel会将日期转换为序列号35981。



默认情况下,Excel for Windows使用1900日期系统。



1904年日期系统

在1904年日期系统中,支持的第一天是1904年1月1日。当您输入日期时,该日期将转换为代表自1904年1月1日以来经过的天数的序列号。例如,如果输入1998年7月5日,Excel会将日期转换为序列号34519。 / p>

默认情况下,Macintosh的Excel使用1904年日期系统。由于早期Macintosh计算机的设计,不支持1904年1月1日之前的日期。该设计旨在防止与1900年不是a年有关的问题。如果您切换到1900年日期系统,则Macintosh版Excel确实支持早于1900年1月1日的日期。



日期系统之间的区别



由于两个日期系统使用不同的开始日期,因此同一日期由每个日期系统中的不同序列号表示。两种日期系统之间的差异为1,462天;也就是说,1900年日期系统中日期的序列号始终比1904年日期系统中相同日期的序列号大1,462天。 1,462天等于四年零一天(包括一天的 le日)。



设置工作簿的日期系统

在Excel中,每个工作簿都可以有自己的日期系统设置,甚至如果打开了多个工作簿。



要在Microsoft Office Excel 2007中设置工作簿的日期系统,请按照下列步骤操作:

1.打开或切换到工作簿

2.单击 Microsoft Office按钮,然后单击 Excel选项

3.单击高级

4.单击以选中在计算此工作簿时下的使用1904数据系统复选框,然后单击确定。 >



请注意,如果您更改已经包含日期的工作簿的日期系统,则日期将偏移四年零一天。



问题在工作簿之间链接和复制日期

如果两个工作簿使用不同的日期系统,则当您遇到问题时,可能会遇到问题在工作簿之间链接或复制日期。具体来说,日期可能会偏移四年零一天。


I have the following formula that I use regularly to copy information from one file to another. Essentially, it takes a given id (A2) and searches for it's match in the second spreadsheet, then copies the data from the column specified in the first part of the formula (in this case, C).

=INDEX([spreadsheet.xlsx]Sheet1!$C$2:$C$50000,MATCH(A2,[spreadsheet.xlsx]Sheet1!$B$2:$B$50000,0))

The formula works perfectly on all columns except when I try to transfer dates. It ALWAYS transfers a date exactly 4 years and 1 day greater than the actual date. I haven't always had this issue transferring dates, but I have no idea what could be causing this.

Any thoughts?

解决方案

Slight abbreviation from Microsoft:


Excel supports two different date systems:

The 1900 Date System
In the 1900 date system, the first day that is supported is January 1, 1900. When you enter a date, the date is converted into a serial number that represents the number of elapsed days since January 1, 1900. For example, if you enter July 5, 1998, Excel converts the date to the serial number 35981.

By default, Excel for Windows uses the 1900 date system.

The 1904 Date System
In the 1904 date system, the first day that is supported is January 1, 1904. When you enter a date, the date is converted into a serial number that represents the number of elapsed days since January 1, 1904. For example, if you enter July 5, 1998, Excel converts the date to the serial number 34519.

By default, Excel for the Macintosh uses the 1904 date system. Because of the design of early Macintosh computers, dates before January 1, 1904 were not supported. This design was intended to prevent problems related to the fact that 1900 was not a leap year. If you switch to the 1900 date system, Excel for the Macintosh does support dates as early as January 1, 1900.

The Difference Between the Date Systems

Because the two date systems use different starting days, the same date is represented by different serial numbers in each date system. The difference between the two date systems is 1,462 days; that is, the serial number of a date in the 1900 Date System is always 1,462 days bigger than the serial number of the same date in the 1904 date system. 1,462 days is equal to four years and one day (including one 'leap' day).

Setting the Date System for a Workbook
In Excel, each workbook can have its own date system setting, even if multiple workbooks are open.

To set the date system for a workbook in Microsoft Office Excel 2007, follow these steps:
1. Open or switch to the workbook
2. Click the Microsoft Office Button, and then click Excel Options
3. Click Advanced
4. Click to select the Use 1904 data system check box under the When calculating this workbook, and then click OK

Notice that if you change the date system for a workbook that already contains dates, the dates shift by four years and one day.

Problems Linking and Copying Dates Between Workbooks
If two workbooks use different date systems, you may encounter problems when you link or copy dates between workbooks. Specifically, the dates may be shifted by four years and one day.

这篇关于在Excel文件之间传输日期(不准确)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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