如何比较Excel中文本字符串中的两个日期?
我有一组具有这种格式的数据: 每个单元格都有一个或一些名称,每个单元格之后都有一个日期。我想比较每个单元格中显示的日期,并检查它们是否相同。
单元内容的示例:大学XXX(2016-10-21)公司YYY(2016-10-22)
我使用了公式:= mid = mid(a1,search(“(”) +1,10)要找到第一个约会。我怎么能找到第二名,第三名,...日期?
“,a1,1 )
I have a set of data with this format:
Each cell has one or some names, each of them are followed by a date. I want to compare the dates which are presented in each cell and check whether they are the same or not.
Example of a cell content: university XXX (2016-10-21) company YYY (2016-10-22)
I used the formula: =MID(A1,SEARCH("(",A1,1)+1,10) to find the first date. how could I find 2nd, 3rd, ... dates?
Thank you in advance,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最简单的话,如果逐步完成:
因此,分解您的MID(A1,搜索(“(”,A1,1)+1,10)(并使其更特定于日期 - 您不想匹配“(kacst)”)为:
B1:
= search(“(2”,A1,1)
和H1:= MID(A1,B1+1,10)
然后添加
C1:
= search(“(2”,A1,B1+1)
这告诉搜索是在其已经找到的字符之后从字符开始的I1:
= MID(A1,C1+1,10)
ETC
Easiest if done step by step:
So break down your MID(A1,SEARCH("(",A1,1)+1,10) (and make it more specific to dates - you don't want to match "(KACST)") as:
B1:
=SEARCH("(2",A1,1)
and H1:=mid(A1,B1+1,10)
Then add
C1:
=SEARCH("(2",A1,B1+1)
This tells the search to start from the character after the one it has already foundI1:
=mid(A1,C1+1,10)
etc
如果您有Office 365(Windows),这是应有的一种方法,具体取决于实际数据的可变性:
filterxml
仅返回包含的节点(
后的10个字符(
不是数字)
例如,如果您想查看是否全部查看是否全部日期是相同的:
如果您没有Office 365,或者您的数据比您显示的内容更多样化,因此我用于确定括号的值是否可靠的方法,我建议您开发一个VBA解决方案,可能使用正则表达式。
If you have Office 365 (Windows), here's one way that should work, depending on the variability in your real data:
FILTERXML
to return only nodes containing the(
(
are not numericFor example, if you wanted to see if all the dates were the same:
If you don't have Office 365, or if your data is more varied than what you show, such that the method I used for determining if the parenthesized values are dates is not reliable, I suggest you develop a VBA solution, possibly using Regular Expressions.