简体   繁体   English

在excel单元格中提取复杂分隔符之间的文本

[英]Extracting text between complex delimiters in excel cells

I have an exported report from a ticketing tool in Excel.我有一个从 Excel 中的票务工具导出的报告。

Each row corresponds to one ticket in the system.每一行对应系统中的一张票。

Column I of each row contains the contents of a Free Text field in the ticketing system, containing date and time stamped comments from the support staff working on the ticket sorted chronologically, most recent first.每行的第一列包含票务系统中自由文本字段的内容,其中包含来自处理票证的支持人员的带有日期和时间戳的评论,按时间顺序排序,最近的放在最前面。

The text field contains multiple entries separated by a time stamp using a uniform format.文本字段包含使用统一格式由时间戳分隔的多个条目。 Each entry may or may not contain multiple lines and line breaks.每个条目可能包含也可能不包含多行和换行符。

Can anyone suggest a way to extract the most recent entry from each cell and put them in their own cell in Column J. Essentially I need everything from and including the first time stamp to the start of but excluding the next time stamp down.任何人都可以提出一种方法来从每个单元格中提取最新条目并将它们放在 J 列中自己的单元格中。本质上,我需要从第一个时间戳到开始的所有内容,包括第一个时间戳,但不包括下一个时间戳。

Sample cell content below.下面的示例单元格内容。

12-10-2018 14:12:09 - Joe Bloggs (Customer Updates) No change this week as project owner has been on leave. 12-10-2018 14:12:09 - Joe Bloggs(客户更新)本周没有变化,因为项目所有者一直在休假。

05-10-2018 08:24:24 - Jane Blogges (Customer Updates) Supplier has produced a more detail proposal for the solution, including a move to an integrated service built on the exiting API's 05-10-2018 08:24:24 - Jane 博客(客户更新)供应商为解决方案提出了更详细的建议,包括转向基于现有 API 的集成服务

Costs yet to be agreed.费用尚未商定。

28-09-2018 14:21:35 - Joe Bloggs (Customer Updates) Discussions continue this week around the suitability of the proposed solution. 28-09-2018 14:21:35 - Joe Bloggs(客户更新)本周继续围绕提议的解决方案的适用性进行讨论。

There is still no clear plan for the project and no overall design document.目前还没有明确的项目计划,也没有总体设计文件。

20-09-2018 11:24:55 -Joe Bloggs (Customer Updates) While a number of meetings to discuss requirements and feasibility have been held no high level design has been proposed and a number of KDD's remain outstanding. 20-09-2018 11:24:55 -Joe Bloggs(客户更新)虽然已经举行了多次会议来讨论要求和可行性,但没有提出任何高级设计,并且一些 KDD 仍然未完成。

17-09-2018 09:59:26 - Joe Bloggs (Customer Updates) Ticket Accepted 17-09-2018 09:59:26 - Joe Bloggs(客户更新)票已接受

Desired out put from this cell would be期望从这个单元格中输出

12-10-2018 14:12:09 - Joe Bloggs (Customer Updates) No change this week as project owner has been on leave. 12-10-2018 14:12:09 - Joe Bloggs(客户更新)本周没有变化,因为项目所有者一直在休假。

It has to be done this way as the PHB responsible wants a "Management Report" without having to actually log into the ticket system themselves.必须以这种方式完成,因为负责 PHB 的人想要一份“管理报告”,而无需自己实际登录票务系统。

It could be done with a formula.它可以用一个公式来完成。 If the text with carriage returns is in cell A2 for example, try this formula.例如,如果带有回车的文本在单元格 A2 中,请尝试使用此公式。 Get the substring starting with the first number and ending with the first carriage return after that first number.获取从第一个数字开始并以第一个数字之后的第一个回车符结尾的子字符串。 Tweak as necessary of course.当然,根据需要进行调整。

=MID(A2, MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")), FIND(CHAR(10), A2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")))-1)

Came up with an answer in the end anyway, using LEFT and FIND after I spotted that there was a reliable repeatable pattern in the string by using "-20" from the year in the date stamp.无论如何,在我通过使用日期戳中的年份的“-20”发现字符串中存在可靠的可重复模式后,使用 LEFT 和 FIND 最终想出了一个答案。 Yes it will break when we get to 2100 but if it's still being used then, god help us all.是的,当我们到达 2100 时它会坏掉,但如果它当时仍在使用,上帝会帮助我们所有人。

=LEFT(A1,IFERROR(((FIND("-20",A1,10))-6),LEN(A1))) =LEFT(A1,IFERROR(((FIND("-20",A1,10))-6),LEN(A1)))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM