【问题标题】:Adding Timecodes in Excel在 Excel 中添加时间码
【发布时间】:2018-11-23 19:11:54
【问题描述】:

我有大约 140 个单元格(它们位于垂直列中),其中包含格式为 hh:mm:ss:ff 的时间码。 每秒有 24 帧。 我想添加它们,所以我有所有提取的总持续时间。 谁能告诉我如何在 Micosoft Excel 中做到这一点? 非常感谢任何帮助,因为我真的一无所知...提前非常感谢!

【问题讨论】:

  • 例如,00:01:07:07 和 00:01:07:09 之间的持续时间是什么样的。它会被测量为 2 帧或 1/12 秒还是什么?
  • 我的列表已经包含持续时间,所以应该是 00:00:00:2

标签: excel duration timecodes


【解决方案1】:

您可以通过做一些数学运算来获得以帧为单位的持续时间。首先,您必须挑选出时间戳的每个部分(小时、分钟、秒和帧),然后只需对其进行数学运算即可获得自某个前一个时间点 (00:00:00:00) 以来的帧数。从中您可以得出每帧的持续时间来自它的前任,并将结果求和为总数:

【讨论】:

  • 非常感谢!因为我必须做几次(有时只为三个单元,有时为 40 个),这有点太忙了。不过还是谢谢你:-)
【解决方案2】:

这可能不是最好的方法(或者可能是?),但它确实有效。

  1. 将 hh:mm:ss 与 ff 分开。
  2. 分别求和 hh:mm:ss 和 ff。
  3. 将帧添加到 hh:mm:ss。

【讨论】:

  • 非常感谢!我最终只计算了没有非常近似数字的帧,但在这个项目的后期阶段,我可能会使用它!谢谢:-)
【解决方案3】:

此代码来自我的 excel 补充“TCCalculator”。计算器是免费的,但不是代码。 如果版主允许,我可以将我的 Google Drive 链接放在这里

你必须做三件事。

1- Create a Button to start the calculation (ButtonTC).
2- Create some VBA functions (I will show it to you)
3- Select a range and click on ButtonTC

通过这种方法,我们可以选择不同单元格的范围。它将成为所有的总和。

您只需要这些功能:

私人子按钮TC_Click

Private Sub ButtonTC_Click()
    Dim framesRef As Double
    ‘framesRef can be 23.98, 24, 25, 29.97…
    'Beware, the decimal point may vary depending on the system configuration
    'The cell that will store the final result must be free of data. We can also get the result with a msgbox
        Cells("1", "A") = f_CalculateRangeTC(framesRef)
End Sub

公共函数 f_CalculateRangeTC

Public Function f_CalculateRangeTC(ByVal framesRef As Double) As String
Dim obj_Cell As Range
Dim sumaTotalFrames As Double
        sumaTotalFrames = 0
        For Each obj_Cell In Selection.Cells
            With obj_Cell
                sumaTotalFrames = sumaTotalFrames + f_CalculateTcInFrames(.Text, framesRef)
            End With
         Next
    f_CalculateRangeTC = f_ConvertFramesTo_HHMMSSFF(sumaTotalFrames, framesRef)
End Function

公共函数 f_CalculateTcInFrames

Public Function f_CalculateTcInFrames(ByVal numToConvert As String, ByVal framesRef As Double) As Double
    Dim fra2f, seg2f, min2f, hor2f As Double
    fra2f = 0
    seg2f = 0
    min2f = 0
    hor2f = 0
    ‘This two sentences convert an unformated number to correct format  1:23:05  to  00012305
    ‘But this not work with this:   1:1:02 (1 minute, 1 second, 2 frames)  becomes 00001102  ¡ERROR!
    numToConvert = Replace(numToConvert, ":", "")
    numToConvert =  Right("00000000" & numToConvert, 8)

    fra2f = Mid(numToConvert, 7, 2)                                 'Frames to frames
    seg2f = Mid(numToConvert, 5, 2) * (framesRef)               ‘Seconds to frames
    min2f = Mid(numToConvert, 3, 2) * (60 * framesRef)      ‘Minutes to frames
    hor2f = Mid(numToConvert, 1, 2) * (3600 * framesRef)        ‘Hours to frames
    sumaFrames = hor2f + min2f + seg2f + fra2f
     f_CalculateTcInFrames = sumaFrames        'Salimos de la función y devolvemos el valor.
Exit Function

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 2020-08-04
    • 2016-04-12
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多