Google Sheets:如何将以mmm:ss或mm:ss格式表示的列数值转换为分钟。

huangapple go评论73阅读模式
英文:

Google Sheets: How to Convert Column Values In mmm:ss or mm:ss Format to Minutes

问题

I currently have a "minutes" column that has values which look like 129:31 or 22:56. The numbers to the left of : are minutes and the numbers to the right of : are seconds. In Google Sheets, how do I take that column of values and convert it to the total number of minutes instead?

For example, 129:31 would become 129.52 minutes, and 22:56 would become 22.93 minutes. The reason I need to do this is because I want to use my new column in a SUMIF statement.

I've tried format mm:ss, but it doesn't return numbers that I can sum.

英文:

I currently have a "minutes" column that has values which look like 129:31 or 22:56

The numbers to the left of : are minutes and the numbers to the right of : are seconds. In Google Sheets, how do I take that column of values and convert it to total number of minutes instead?

For example 129:31 would become 129.52 minutes and 22:56 would become 22.93 minutes. The reason I need to do this is because I want to use my new column in a SUMIF statement.

I've tried format mm:ss but it doesn't return numbers that I can sum.

答案1

得分: 2

从您的以下回复中,

>它们是文本(不是日期对象);我不想覆盖这些单元格... 而是创建一个新的列,其中包含129.52和22.93。

以下示例公式如何?

=BYROW(A1:A, LAMBDA(range, IFERROR(LET(res_1, SPLIT(range, ":"), res_2, INDEX(res_1, 1, 1), res_3, INDEX(res_1, 1, 2)/60, res_2 + res_3))))

Google Sheets:如何将以mmm:ss或mm:ss格式表示的列数值转换为分钟。

  • 在此示例公式中,文本129:31:分割,并且31被除以60
英文:

From your following reply,

> they are the text (not a date object); I don't want to overwrite those cells ... create a new column with 129.52 and 22.93 instead.

how about the following sample formula?

=BYROW(A1:A,LAMBDA(range,IFERROR(LET(res_1,SPLIT(range,":"),res_2,INDEX(res_1,1,1),res_3,INDEX(res_1,1,2)/60,res_1 + res_3))))

Google Sheets:如何将以mmm:ss或mm:ss格式表示的列数值转换为分钟。

  • In this sample formula, the text 129:31 is split by : and 31 is divided by 60.

答案2

得分: 0

另一个选择是使用TIMEVALUE函数,它接受一个字符串并将其转换为数字(您可以按数字或日期格式进行格式化,根据您的需求)。由于TIMEVALUE的输入是一个包含小时的字符串,我建议您只需在前面添加0:以添加“小时”:

=TIMEVALUE("0:"&A1)

只是为了向您展示,现在您已经有了正确的日期格式,我在截图中将您提供的两个值相加

如果您只想要按照您的要求的确切数字,将其乘以24(小时)和60(分钟)。

英文:

Another option is to use TIMEVALUE which takes a string and converts it to a number (you can format it as a number or as date, if you want). Since the input of TIMEVALUE is a string with hours, I suggest you just add a 0: to add the "hours":

=TIMEVALUE("0:"&A1)

Just to show you that now you have a correct date format, I summed in the screenshot both values you provided

Google Sheets:如何将以mmm:ss或mm:ss格式表示的列数值转换为分钟。

If you just want the number exactly as you requested, multiply it by 24 for hours and 60 for minutes

huangapple
  • 本文由 发表于 2023年7月3日 08:58:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76601322.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定