Saturday, October 13, 2012

Google Spreadsheet formula to calculate frames from a string value


Question:

( by 
Max Peleh )

Hello, 
I need to convert 00:00:09:16 like number into another format - frames, this number represents a time in Hours:Minutes:Seconds:Frames, for example the result of this specific converted number should be 241 (9 seconds* 25fps(or any other fps value) +16 frames), is there any way to make a formula for this?
It should look something like this 
(x-Hours*90000(frames in 1 hour) + (x-Minutes*1500(frames in minute) + x-Seconds*25(frames in second) + x-frames

Is there any way this could be possible to create in the spreadsheet?
And is there a way to apply this formula to existing document filled with these numbers without recreating the whole document / applying on each cell individually?

Thanks to anyone who will try to help me! =)

Solution:

If you have the following value in Cell A1
00:00:09:16

Then put the following formula in Cell A2:
=QUERY(SPLIT(A1;":");"select ((Col1*90000)+(Col2*1500)+(Col3*25)+(Col4)) label ((Col1*90000)+(Col2*1500)+(Col3*25)+(Col4)) '' ")

The above formula will give you the output as value:
241

And if the value in Cell A1 is: 00:22:14:11
It will display the calculated value as: 33361


I hope the above solution will help you, and if you need more help then please do comment below on this blog itself, I will try to help you out.

I also take up private or confidential projects:

If this blog post was helpful to you, and if you think you want to help me too and make my this blog survive then please donate here: http://igoogledrive.blogspot.com/2012/09/donate.html 

Thanks,
Kishan,

1 comment:

  1. What if the value is at "frame" and I would like to convert it into the format like this "00:00:09:16" with 24 frame rate. What is the formula then? Thank you in advance for the answer :)

    ReplyDelete