在一个单元格中显示两个日期 [英] Displaying two dates in one cell

查看:720
本文介绍了在一个单元格中显示两个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Excel的一个单元格中显示两个日期.

我使用了公式:

=DATE(YEAR(NOW()),MONTH(NOW()), I1) & " & " & DATE(YEAR(NOW()),MONTH(NOW()),I15)

其中I1和I15的值分别为1和15.之所以选择此公式,是因为我希望每个日期都显示当月的1号和15号.我希望此单元格读取"7/1/12&7/15/12",但是现在当前公式为我提供了"41091& 41105",我已对该单元格进行了格式化,以显示我想要的正确日期格式.有办法解决这个问题吗?

解决方案

使用Text()函数:

=TEXT(DATE(YEAR(NOW()),MONTH(NOW()),I1),"mm/dd/yyyy") & " & " & TEXT(DATE(YEAR(NOW()),MONTH(NOW()),I15), "mm/dd/yyyy")

第二个参数控制数据的格式.可以在此处找到有效值.. >

I am trying to display two dates in one cell in Excel.

I have used the formula :

=DATE(YEAR(NOW()),MONTH(NOW()), I1) & " & " & DATE(YEAR(NOW()),MONTH(NOW()),I15)

Where the values of I1 and I15 are 1 and 15 respectively. The reason I chose this formula is because I want each date to display the 1st and the 15th of the current month. I would like this cell to read "7/1/12 & 7/15/12" however right now the current formula is giving me "41091 & 41105" I have formated the cell to display the correct date format that I want. Is there a way to fix this?

解决方案

Use the Text() function:

=TEXT(DATE(YEAR(NOW()),MONTH(NOW()),I1),"mm/dd/yyyy") & " & " & TEXT(DATE(YEAR(NOW()),MONTH(NOW()),I15), "mm/dd/yyyy")

The second parameter controls how the data should be formatted. Valid values can be found here.

这篇关于在一个单元格中显示两个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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