在excel日期比对大小_如何在Excel中分割日期和时间

在excel日期比对大小

If you download data into Excel, one column might have a combined date and time value. If you're going to create reports from that data, it's usually easier if you have the date and times in separate columns. See how you can do that with a simple formula, or a quick bit of typing.

如果将数据下载到Excel,则一列可能具有组合的日期和时间值。 如果要从该数据创建报告,则将日期和时间放在单独的列中通常会更容易。 了解如何通过简单的公式或快速键入操作。

Split Dates and Times http://blog.contextures.com/

分割日期和时间 (Split Date and Time )

In Excel, dates are stored as numbers, as you can see in the screen shot below. The integer in cell B3 (42418) represents the date, and the decimal portion (.50) is the time.

在Excel中,日期存储为数字,如下面的屏幕快照所示。 单元格B3中的整数(42418)代表日期,小数部分(.50)是时间。

intfunction05

使用INT功能 (Use the INT Function)

A simple way to split the date and times is with the INT function. Because it returns an integer, the INT function can calculate the date from a date/time combination.

分割日期和时间的简单方法是使用INT函数。 因为它返回一个整数,所以INT函数可以根据日期/时间组合计算日期。

If the date/time data is in cell A2, use this formula to get the date (the integer): =INT(A2)

如果日期/时间数据在单元格A2中,请使用以下公式获取日期(整数): = INT(A2)

NOTE: After you enter the formulas, format those columns with your preferred Date and Time formats.

注意:输入公式后,请使用首选的日期和时间格式设置这些列的格式。

intfunction02

获取时间值 (Get the Time Value)

To calculate the time value, we'll subtract the date integer value from the combined date and time. The remaining decimal portion is the time.

要计算时间值,我们将从合并的日期和时间中减去日期整数值。 剩余的小数部分是时间。

In the example below, the combined date/time is in cell A2. To calculate the time, enter the following formula in cell C2:

在下面的示例中,合并的日期/时间在单元格A2中。 要计算时间,请在单元格C2中输入以下公式:

 =A2 - INT(A2])

= A2-INT(A2])

使用Flash填充 (Use Flash Fill)

If you're using Excel 2013 or later, you can use the Flash Fill feature to get the date or time in a separate column, without formulas. However, these values will NOT update automatically if the combined date/time cell changes -- these are static entries.

如果您使用的是Excel 2013或更高版本,则可以使用“快速填充”功能在单独的列中获取日期或时间,而无需使用公式。 但是,如果合并的日期/时间单元格发生更改,这些值将不会自动更新-这些是静态条目。

Here's how you can use Flash Fill for dates or times.

这是您可以使用Flash Fill处理日期或时间的方法。

  • Type the first two dates in column B, based on the dates in column A.

    根据A列中的日期,在B列中键入前两个日期。
  • On the Excel Ribbon, click the Data tab on the Excel Ribbon

    在Excel功能区上,单击Excel功能区上的“数据”选项卡
  • Click the Flash Fill command

    单击“快速填充”命令

The rest of the dates should fill in, and you can use the Flash Fill options box to confirm or undo the changes.

其余日期应填写,您可以使用Flash Fill选项框确认或撤消更改。

Do the same thing to fill in the Time column -- enter the first two times, then use the Flash Fill feature to complete the list.

做同样的事情以填充“时间”列-输入前两次,然后使用“快速填充”功能完成列表。

flashfilldates04

下载样本文件 (Download the Sample File)

To get the sample file, go to the Split Date and Time page on my Contextures website. There is a link in the Download the Sample File section. The zipped file is in xlsx format, and does not contain macros.

若要获取示例文件,请转到Contextures网站上的“拆分日期和时间”页面 。 在“下载样本文件”部分中有一个链接。 压缩文件为xlsx格式,不包含宏。

观看视频 (Watch the Video)

To see the steps for splitting the date and time, watch this short video tutorial. You'll see both methods – the formula, and the Flash Fill.

要查看拆分日期和时间的步骤,请观看此简短的视频教程。 您将看到两种方法-公式和Flash Fill。

演示地址

翻译自: https://contexturesblog.com/archives/2016/02/18/how-to-split-date-and-time-in-excel/

在excel日期比对大小

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值