如何在Excel中将文本类型的Duration数据转换为时间数据格式?

How to convert text type Duration data to time data format in Excel?

我正在尝试对 UFO 目击事件的公开数据进行一些分析。我从 National UFO Reporting Center.

收集了数据

数据如下所示:

Date / Time     City    State   Shape   Duration    Summary     Posted
9/29/15 04:00   Wheaton     IL  Unknown     3 minutes   Object hovering for 1 minute, brightly lite and loud. Then moved past slowly. I called FAA to see if they knew what it was, they transf     9/29/15
9/28/15 23:17   Hendersom   NV  Triangle    ~1 minute   V-shape/triangle UFO sighting in Henderson and Las Vegas, NV.   9/29/15
9/28/15 22:08   Dousman     WI  Fireball    5 minutes   Bright yellowish/white light hovering, no sound of craft.   9/29/15
9/28/15 21:10   Tacna   AZ  Triangle    ~15 seconds     Brightly lit craft flew and hovered right in front of us, then disappeared.     9/29/15
9/28/15 20:35   York    ME  Triangle    10 minutes  Triangle bright flashing white light, releasing a red and white pattern craft heading straight up.  9/29/15

有数百条记录,现在我在读取 Duration 列的数据时遇到问题,因为它是用简单文本编写的。我希望它是一个代表时间的数字(3 分钟为 3,30 秒为 0.5,等等)。我想自动执行将列转换为实际持续时间的过程。

如何在 Excel 中做到这一点? (或者甚至在 R 中??)

假设持续时间数据在 E 列中,请在第 2 行的空白单元格中尝试此公式:

=MID(SUBSTITUTE(E2,"~",""),1,2)/IFERROR(IF(FIND("seconds",E2),60),1)

现在根据需要向下复制。

注意:此公式假设没有复合时间,并且所使用的时间单位只有分钟和秒;它没有规定时间。如果您需要时间,请告诉我。