如何仅从列中取出日期并将日期复制到具有另一种日期格式的另一列?

How to take only the date out of columns and copy the date to another column with another format of the date?

脚本应该从 B 列中取出日期,只将日期处理到 D 并将其格式化为欧洲日期格式。 这可能吗?

不需要为此使用脚本。 regexextract 函数可以提取日期,然后可以将其重新组合成任何格式。最好使用三个可能隐藏的辅助列(例如,X、Y、Z)。在 X2 中,输入

=regexextract(B2, "(\d{2})/(\d{2})/(\d{4})") 

这会将月份、日期和年份放入单元格 X2、Y2、Z2 中。然后在D2中,输入

=Y2 & "." & X2 & "." & Z2

大功告成。

这也适用于 arrayformula 模式,一次处理整个列:

=iferror(arrayformula(regexextract(B2:B, "(\d{2})/(\d{2})/(\d{4})")))

其中 iferror 抑制来自不包含日期的单元格的错误。

之后,

=arrayformula(if(len(Z2:Z), Y2:Y & "." & X2:X & "." & Z2:Z, ))

重新组合日期,再次在没有解析出日期的地方留下空白。