实现分离Excel单元格内的日期和时间
时间:2023-10-05 10:36:30
如果一个Excel单元格内同时包含日期和时间,如A1单元格中包含“2011-6-8 13:13:16”,要将其中的日期和时间分离到不同的单元格,可以用下面的公式:
在B1单元格中输入:
=TRUNC(A1)
或:
=INT(A1)
再设置单元格格式为日期即可得到A1单元格中的日期。由于Excel将日期和时间存储为一个序列数,本例A1单元格的序列数为“40702.5508796296”,其小数点左侧的表示日期,小数点右侧的表示时间,故用TRUNC函数截取整数部分即得到日期。由于日期不可能为负值,用INT函数也可得到同样的结果。
在C1单元格中输入:
=MOD(A1,1)
或:
=A1-B1
两公式都返回A1单元格的序列数的小数部分,再设置单元格格式为时间即可得到A1单元格中的时间。
另外,下面的公式也可显示A1单元格中的日期和时间:
=TEXT(A1,"e-m-d")
=TEXT(A1,"hh:mm:ss")
但这只是通过TEXT函数按日期和时间格式显示的结果,如果将该公式返回的结果用于其他公式,如VLOOKUP函数,可能会返回错误值。
标签:公式,单元格,日期,时间,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
win10开机声音怎么关?win10电脑关闭开机声音操作教程
2022-11-17 05:49:03
![](https://img.aspxhome.com/file/2023/28/a240219_0s.jpg)
如何重装系统Win11?新手重装Win11系统教程
2023-02-22 17:49:38
![](https://img.aspxhome.com/file/2023/27/a235560_0s.png)
0x80004005错误代码怎么解决-0x80004005错误代码解决方法
2022-10-27 09:35:03
![](https://img.aspxhome.com/file/2023/2/a289426_0s.jpg)
win10开机黑屏很久才进入桌面_win10黑屏很久才进入桌面的解决方法
2023-01-07 03:21:44
![](https://img.aspxhome.com/file/2023/3/a295756_0s.png)
Win8如何切换Metro应用?Win8切换Metro应用的方法
2023-08-23 06:32:10
![](https://img.aspxhome.com/file/2023/2/a285497_0s.jpg)
word 2019更改文档默认保存路径和格式的方法
2022-07-27 16:10:27
![](https://img.aspxhome.com/file/2023/4/35234_0s.jpg)
Win101909怎么查看硬盘分区格式_Win101909查看硬盘分区格式方法
2022-12-29 09:36:48
![](https://img.aspxhome.com/file/2023/5/a315657_0s.jpg)
在Excel中如何使用Accrintm函数?
2023-08-19 05:53:37
![](https://img.aspxhome.com/file/2023/6/42286_0s.jpg)
Win10提醒事项如何打开?Win10提醒事项打开的方法
2022-05-16 00:03:27
![](https://img.aspxhome.com/file/2023/26/a219841_0s.jpg)
Win8系统怎么更改电脑ip地址?
2023-10-04 09:10:50
![](https://img.aspxhome.com/file/2023/3/a295574_0s.png)
Windows7怎么看内存条频率?
2022-09-26 02:50:13
![](https://img.aspxhome.com/file/2023/27/a230904_0s.jpg)
Excel中怎样合并或拆分单元格
2023-08-27 15:40:25
![](https://img.aspxhome.com/file/2023/8/38138_0s.jpg)
Mac电脑剪切板在哪里找?苹果电脑剪切板打开教程
2023-12-18 16:44:04
![](https://img.aspxhome.com/file/2023/5/a215775_0s.jpg)
各种U盘启动盘制作工具
2022-07-31 16:18:55
![](https://img.aspxhome.com/file/2023/3/a300558_0s.png)
iOS 12 beta10修复了哪些内容?iOS 12 beta10值得更新吗?
2023-07-09 02:26:44
![](https://img.aspxhome.com/file/2023/1/a199721_0s.jpg)
WPS表格怎么搜索关键词
2022-06-30 05:53:08
![](https://img.aspxhome.com/file/2023/0/a186000_0s.jpg)
Win10 Mobile一周年更新正式版已通过蓝牙认证
2023-08-07 12:12:42
![](https://img.aspxhome.com/file/2023/29/a261194_0s.jpg)
快剪辑怎么调整画面尺寸?快剪辑调整画面尺寸的方法
2022-12-12 01:42:56
![](https://img.aspxhome.com/file/2023/8/a336951_0s.png)
Win7 32位旗舰版系统下防火墙无法启动提示错误0x6D9怎么办?
2023-05-16 15:49:21
![](https://img.aspxhome.com/file/2023/27/a229506_0s.png)
电脑出现两个D盘怎么将动态磁盘到基本磁盘?
2022-12-30 05:11:54
![](https://img.aspxhome.com/file/2023/6/a322517_0s.png)