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

时间:2015-10-02 16:15:13

标签: excel data-analysis

我试图对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

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

如何在Excel中执行此操作? (或者甚至在R ??中)

1 个答案:

答案 0 :(得分:1)

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

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

现在根据需要复制。

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