早上好,伙伴们!
我有一个google电子表格generatin活动信息,如下所示,其中短语插入每行一个单元格中:
April 19, 2018 at 12:07AM
April 19, 2018 at 12:07AM
April 19, 2018 at 12:15AM
April 19, 2018 at 12:15AM
April 19, 2018 at 11:43AM
April 19, 2018 at 11:43AM
这些行不断更新新的活动信息,报告与时间,月,年和日相关的活动。
我想将这些信息分成4个单元格而不是一个单元格。
[月] [日] [年] [时间]< ----每个人在一个分离的单元格中。
要做到这一点,我认为我需要一个公式来将短语的月份提取到一个新的单元格,然后需要将该日期用于另一个单元格,然后是年份,然后是时间。但我不清楚如何做到这一点。你能帮助我吗?
非常感谢!
答案 0 :(得分:1)
如果显示如下字符串:
作为日期提取的基本公式,我将把它放在A2中,所以我可以参考A2前进而不是长公式,假设A1有字符串是
=SUBSTITUTE(TRIM(SUBSTITUTE(Left(A1,find("at",A1)-1),CHAR(32)," ")),",","")
给出:
April 19 2018
然后我可以用
提取其他部分<强>月强>
=choose(month(A2),"January","February","March","April","May","June","July","August","September","October","November","December")
日期强>
=day(A2)
<强>年强>
=year(A2)
<强>时间强>
=right(TRIM(SUBSTITUTE(A1,CHAR(32)," ")),len(TRIM(SUBSTITUTE(A1,CHAR(32)," ")))-(find(":",TRIM(SUBSTITUTE(A1,CHAR(32)," ")),1)-3))
在工作表中:
您当然可以嵌入公式并避免使用A2。我发现它更容易阅读。嵌入一天的示例是:
=day(SUBSTITUTE(TRIM(SUBSTITUTE(Left(A1,find("at",A1)-1),CHAR(32)," ")),",",""))
如果您将起始字符串转换为可识别为日期的内容,您当然也可以使用DATEVALUE。再次举行示例:
=DAY(DATEVALUE(SUBSTITUTE(TRIM(SUBSTITUTE(Left(A1,find("at",A1)-1),CHAR(32)," ")),",","")))
答案 1 :(得分:1)
function listenChangesOn(form,fields:string[]){
return Observable.merge(fields.map(field=>form.get(field).valueChanges))
}
答案 2 :(得分:0)
您可以使用
转换为真正的日期时间=--SUBSTITUTE($A1, " at ", " ")
答案 3 :(得分:0)
=ARRAYFORMULA(REGEXEXTRACT(A2:A7,"^(\w+)\s+(\d+),\s+(\d{4})\s+at\s+(.+)$"))