How to calculate the difference between two "elapsed" times with Google Sheets - google-sheets

I have two columns in Google Sheets, column 1 is a list of my times around a track in the format "01:23.456" or "minutes:seconds.milliseconds". Column 2 is a list of someone else's times around a track in the same format. I'm looking for a way to calculate the difference between my time and the other person's time to see how far behind I currently am.
I have already tried multiple different different date and time formats and even attempted to make a custom number format. I am kind of new to Google Sheets so I may have been going at this problem incorrectly.
For example, if my time around the track was "01:00.00" and the other person's time was "00:50.500" then the third column should display "00:09.500". Currently all of my attempts give me the same error which is "is a text and cannot be coerced to a number".

=TEXT(MINUS(LEFT(A1, 2)*60*1000+MID(A1, 4, 2)*1000+RIGHT(A1, 3),
LEFT(B1, 2)*60*1000+MID(B1, 4, 2)*1000+RIGHT(B1, 3))*0.001, "00:00.000")

Related

set times with miliseconds in google sheet [duplicate]

This question already has answers here:
How to SUM duration in Google Sheets?
(5 answers)
Closed 8 months ago.
some time ago I ported an old timesheet to the google-timesheet to be able to share it online and have others modify it but didn't keeped it so I don't remember how I manage to do.
The goal is to compare two timing sheet, today I wanted to edit the sheet to be able add new datas and write timing in separate page sheet which simplify the comparation as I'll just have to import the data from the page and not rewrite it all the time. My issue is that I'm not enable to replicate on my new pages the format. What I would like is to have this exemple working
Cities
Time
Helsinki
2:04.820
Travemünde
4:03.290
Hambourg
0:30.900
Hanovre
2:28.610
Francfort
4:53.470
Mannheim
1:35.170
Strasbourg
2:13.650
Berne
2:25.190
Genève
2:22.620
Lyon
2:24.000
Marseille
3:34.550
Marseille (ferry)
Palerme
2:28.670
Catania
4:07.670
Total
=SUM(above)
so that I can replicate the format on the other pages as I don't understand why it worked before but not now.
mm:ss.000 is the format I would like to have, but atm my format is [h]:mm:ss.000 and it seems that the hour markdown is necesary so I don't really mind if we need to keep the hour.
This is completely possible with google sheets. Enter the data in the format hh:mm:ss.ms, and use sum() (with a range, obv.) to sum the column. Then select the whole colume and apply a custom number format (data-> custom time/date). Using the dropdown to get the parts and typing the separators you can get Minute(1): Seconds(1).Milliseconds(3) which seems to be what you want.
For sheets to recognise the cell entry as a time it needs the hh: part. But you can certainly hide that in the display.
Demo Spreadsheet
If the spreadsheet locale is set to something which uses , for the decimal point, you need to use that instead of . Google could definitely make that a lot clearer. If you have the time you might even want to open a bug report with them, as the examples in their docs don't work when the locale requires a ,.
As a bonus, you can bulk-convert using a formula like =replace(B2; find("."; B2); 1; ",") * 1 (where B2 is the cell to be converted). Drag down, copy and paste the values, and then format if need be.
use:
=ARRAYFORMULA(TEXT(SUM(IFERROR(TIMEVALUE("0:"&B1:B15))); "[m]:ss.000"))

Calculating average for more than one month of data

I am writing some formulas that will make up a dashboard that allows for a dynamic look-up of change in waiting times for admission into a hospital. In this case, what I want to do is create a lookback period of 1 month, 3 months, 6 months, and 1 year to see how waiting times have changed during this time at a few locations. It's a bit of a complex issue, but the stripped down data and my example code can be found here (fully shared for editing).
I have successfully gotten the correct formulas for finding 1 month worth of change, but how to apprroach more than 1 month's worth of data eludes me and this is especially problamatic because the date formatting is not standard excel/google sheets data format. As this data will be continously fed into the spreadsheet, I don't think I have the option to modify it either so I think the only option is to come up with some pretty funky formulas that treat months as text. Alternatively, I guess I can also try to make a formula that reformats the text into valid google sheets dates and then use that to make calculations but then while I could probably write that formula, I'd still not know how to get multiple months worth of data processed. Can anyone help take a look at the sheet? (feel free to copy/edit the file if necessary).
try like this:
=QUERY({INDEX(SPLIT(Data!A3:A, "T"),,1), Data!B3:C},
"select avg(Col3)
where Col1 >= "&DATEVALUE(EOMONTH(TODAY(), -4)+1)&"
group by Col2
label avg(Col3)''")
spreadsheet demo

States VLOOKUP on a continuously added to Google Sheet

Ok I have been fighting this for a few days now... and ever time I think I have it I don't.
I have a Google Sheet that is continuously being added to from different sources. It is collecting orders from several e-comm outlets. I organize the data to come in generally how I need it from the sources. I them am taking that data and putting it into Data Studio. But since the sources are different, the State field comes in in many different formats, but I need them to all be the same, preferably abbreviations. I have been trying to do a VLOOKUP on a Named Range created in a separate sheet that has all the variations of states that I have seen in column 2 and the abbreviated version in column 1. Then in my main data sheet I am doing a big formula in row 1 of the column that I am trying to output the state abbreviations.
Here is the formula:
=ArrayFormula(IF(ROW(B:B)=1, "Shipping State Abbv", IF(C:C = "US", IFERROR(VLOOKUP(B:B, StatesList, 1, TRUE), B:B), B:B)))
Note: There are some countries other than US, so if it is not US I just want the value from Column C.
I have created a small sample of data that is showing what is happening here. If someone could please help me figure out what is wrong and help me fix it that would be fantastic!
Another Note: The sheet States List 2 is another format for laying out the different versions of the states, if that could utilized instead, that may be nicer to maintain. Basically find the value in the sheet and use column 1 as the returned value.
I think I found what was going on, as your vlookup was not doing a very good job.
Basically I just copied the values from States List to States List 2 and swapped the columns A and B on the States List 2:
Then updated the value of the function to this:
={"Shipping State Abbv"; ARRAYFORMULA(IF(LEN(A2:A),if(C2:C = "US",VLOOKUP(upper(B2:B), 'States List 2'!A:B,2,FALSE),C:C),))}
Let me know if you manage to succeed.

Is there a maximum number of named ranges in google sheet

I am writing a Python program to extract values from a google sheet and I am running into a weird problem whereby named ranges that I know I have put in to the sheet starts disappearing. When I re-enter them, some other range disappears. This has happened after I have added a large number of named ranges. I don't get any error message and it is seems somewhat random which ranges disappears. Could it be that there is a maximum number of named ranges and that some old ranges are removed automatically when I add a new one? I have search for any maximum number in the documentation but haven't been able to find one.
Yes, there is. Currently nine hundred and ninety nine (999).
'Suck it and see' courtesy Jacob Jan Tuinstra.

Google Sheets: How do I look up multiple values in another sheet?

The scenario I am faced with is kind of an odd one. Basically, I am designing a Google Sheet for work that will allow the employees to log their tech support phone calls and then a report will automatically update on another page, keeping a collective tally of sorts of all the activity on a particular day.
What I am trying to do is write a function that searches another sheet for a particular date and, if that date is found, sum a particular column of values for that day only. There are pictures attached that should help explain the problem.
Basically, I am trying to write a general equation in the cell reading "FALSE" that will look up the date of that row (in this case 1/1/2017) in the "Spendgo Minutes" sheet. If that date were to be found somewhere on that sheet (not necessarily at the top of the sheet), the "Minutes Gained" column would be summed up, but for that date only (not the entire column). Here is my running formula right now that has errors:
=IF(COUNTIF('Spendgo Tally'!$A$3:$A,$B7),'Spendgo Tally'!$G3)
Does anyone know how this might be possible? Feel free to ask any clarifying questions.
You're looking for SUMIF
= SUMIF('Spendgo Tally'!$A$3:$A,$B7,'Spendgo Tally'!$G3:$G)

Resources