There are 3 columns in my google sheet with heading Start time (col C), End Time (col D) and time taken (col E). Column E is arrived by finding the difference between col D and col C. Now when I try to convert col E into seconds, I am not getting the required output. Pls help me in solving this query by having the correct value in column E
Google Sheets – Convert Duration to Seconds
formulasgoogle sheetsgoogle-sheets-cell-formatgoogle-sheets-dates
Related Topic
- Google-sheets – Using Query and Importrange to pull Google Form data from one worksheet to another
- Google-sheets – How to use an ArrayFormula containing a partial range
- Google-sheets – Combine multiple sheets in one master file
- Google-sheets – How to create a functional time menu in Google Sheets
- Google Sheets – Calculate Total DateDif Average Between Two Columns
- Google-sheets – Values are being updated lated using formula
Best Answer
Set your start and end fields to time format
(Format -> Number -> Time)
and your time difference calculation field to duration format(Format -> Number -> Duration)
.Once you have done that you can just add and subtract times like normal number to get the time difference. However, you will get a negative time if one event stretches past midnight. So, apply if condition and add 24 hours whenever the event stretches midnight.
or you can manually prevent this condition like here.
To calculate the number of seconds, you can use the
Hour()
,Minute()
andSecond()
functions on that field.Here is the link to illustration sheet.