Timezone auto adjust for Google sheets cell data - google-sheets

I am trying to create an availability spreadsheet for people on a group google sheet, but we are all in different time zones. In order to avoid conversion confusion, I want to create a sheet that will auto adjust the cell data i.e. Ryan (who lives in the eastern time zone) says he is available on Monday from 5 to 10 PM. If Steve (who lives in the central timezone) looks at the sheet it will show that Ryan is available from 4-9 PM

I'm pretty sure that the answer to your question is that it's not possible without doing some cavalier sheet manipulation or linking spreadsheets. Basically with the exception of random numbers, cells have to calculate to the same result for all users. If both Steve and Ryan opened the sheet, the date/time displayed is the same for both viewers.
The time zone is set within the spreadsheet settings, which is actually a good thing (otherwise users would need to specify what timezone they were entering date values in by each cell).
Looking at your very brief use-case, I might consider making sheets by time zone and then create a button that views which user it is. Or possibly have a button that sets the sheets time zone based on user? There are lots of workarounds but not in the direct method you're asking for.
As I wrote this response, I got curious and made this google sheets concept that selects the time zone by user, if they are listed in Column J and their timezone in column K. It's not great as it requires a click, but if you make your own copy and maybe you can get some ideas.
Here's the code I used in the script editor:
/**
* #OnlyCurrentDoc
*/
const nUserCell = 'userCell';
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
/**
* Returns the difference in minutes from spreadsheet from UTC.
*
*
* #return The Difference In Minutes
* #customfunction
*/
function getSheetTimeZone(){
var d = new Date();
return d.getTimezoneOffset();
}
function setUser(){
var theUser = Session.getActiveUser().getEmail();
ss.getRange(nUserCell).setValue(theUser);
}

Related

Multiple criteria Countif unable to match due to date range, importrange

I am attempting to build a live dashboard for our lovely mechanics to see how many services they have completed in a day. The majority of the time it will be used to only show services from a certain mechanic on today's date, however I would like to be able to change the date it shows date for and so would like to be able to grab that criteria from a certain cell in sheet.
My current thinking is that the dashboard would have a formula like this:
=COUNTIFS(
IMPORTRANGE(
"https://docs.google.com/spreadsheets/d/1bx65qPAChwZ8uxwJsMfh-w5uALdKVdnn8x7LXD6J3zs",
"Servicing!A:A"),
D1,
IMPORTRANGE(
"https://docs.google.com/spreadsheets/d/1bx65qPAChwZ8uxwJsMfh-w5uALdKVdnn8x7LXD6J3zs",
"Servicing!C:C"),
C7)
D1 is where i can put in the date. C7 is where the mechanics name is held. My thinking is that this is not working as the data is populated using a google form. This google form records a timestamp in the following way '3/13/2020 12:09:56' Meaning that It will only match this data if the exact same time matches. Is there a way to make it search for ALL records on a date instead of all from a precise time?
Thanks for reading!
I was able to remove the time from the google forms output by adding and extra column and using this formula
=TO_DATE(DATEVALUE(B805))
B805 is filled by the time stamp from the google form
I then made my formula search for the info in the new colum with the above in each cell. It worked! :)

Google Spreadsheet converting time automatically to current timezone

I have a google spreadsheet with a cell with my current time.
For example: Meeting at: 17:15
Is there a way, when a person from another computer and timezone opens the spreadsheet, that he can see the time in his current time zone.
Example: Meeting at: 2:15 pm.
Something like cell: =convertTime(17:15,"UTC +1) that automatically shows the 17:15 UTC+1 in your time zone?
Thanks
It's not possible to show different cell values to different users.
Google Sheets has a timezone setting for each spreadsheet but it hasn't a built-in fuction able to get the timezone of the current user. By the other hand custom function are executed anonymously so they will not be able to automatically get the current user timezone.
One option is to use Google Apps Script to create an user interface like a dialog or sidebar that use client-side code to show date / time value in the active user timezone.
Resources
https://developers.google.com/apps-script/guides/sheets

Method to copy data from another sheet where date range (time on project) exists within another date range (month)

I'm currently loading in some resource data into one sheet (summary) to populate another sheet (weekly), based upon whether or not there was planned activity for that resource in the month in question. From that data, and what activity was, I'm then trying to establish the projected hours for each resource and then record the actuals, to track the performance of the team.
I'm currently using this formula (cell B8) to pull the data from Summary sheet, based upon the month indicated in G6:
=QUERY(Weekly!B7:K99,"select E,B,C,I,J,D,H,G where I >= date '"&TEXT(G6,"yyyy-mm-dd")&"'")
I'm also using this formula, in N8, to establish whether the days in the month had allocated time, and if so, at what percentage:
=QUERY(Weekly!B7:K99,"select E,B,C,I,J,D,H,G where I >= date '"&TEXT(G6,"yyyy-mm-dd")&"'")
While this seems to work for November, it breaks down for other months. I've tried multiple variations to try and get it to work, but I can't seem to be able to establish whether the month has time in it, and then to accurately record it.
Any ideas as to how to get this to work?
Here's a version of the sheet I'm working with:
https://docs.google.com/spreadsheets/d/1epCnivFZvxjPNBdNK82Np0aPfFN1LbIXHrrbgnQEQus/edit?usp=sharing
Try this one:
=query(arrayformula({Weekly!B7:K99,text(Weekly!I7:I99,"yyyy-mm-dd")}), "Select Col4,Col1,Col2,Col8,Col9,Col3,Col7,Col6 where Col11>='" & TEXT(G6,"yyyy-mm-dd") & "'",0)
where Col1:Col9 = B:J

Google Sheets Array Formula for Time Series

I'm working on a google sheet that generates a monthly time series based on the following information:
Start Date (C17)
End Date (C18)
Amount at the beginning of the period (C19)
Deductions during the period (D19:L19)
My current setup looks like this:
I need two ArrayFormulas:
One to populate the column's deducted amount (D19:L19) if the date (B21:B) is within the deduction date range (D17:17, D18:18)
One to calculate the effective post-deduction amount at the end of each month.
I am using ArrayFormulas because I expect regular users to have a hard time auto-populating normal formulas after pasting particularly long rows of deduction details.
The time series table is intended to be generated by feeding data from another table - one that has the monthly starting amount and deduction details using the fields of Start Date, End Date and Amount. So far, I've been able to put together are the following:
Months in Range:
=datedif($C$17,$C$18,"M") - named range "ScheduleMonths"
Column of Months:
=ArrayFormula(edate(C17,row(B1:indirect("B"&ScheduleMonths))))
Monthly Total Remaining:
=ARRAYFORMULA(C21:indirect("C"&ScheduleMonths+20)-
D21:indirect("D"&ScheduleMonths+20)-E21:indirect("E"&ScheduleMonths+20)-
F21:indirect("F"&ScheduleMonths+20)-G21:indirect("G"&ScheduleMonths+20)-
H21:indirect("H"&ScheduleMonths+20)-I21:indirect("I"&ScheduleMonths+20)-
J21:indirect("J"&ScheduleMonths+20)-K21:indirect("K"&ScheduleMonths+20)-
L21:indirect("L"&ScheduleMonths+20))
This is the normal formula I set up for use in the table fields:
=if(AND(C$17<=$B21,$B21<=C$18),C$19,"")
I expect the resulting ArrayFormulas to populate all monthly deduction cells with the proper deduction amounts should the date (B21:B) fall within the deduction date range (D17:17, D18:18). So far, I have only achieved this with normal formula.
Update: I figured out how to do the post-deduction amount in A22.
=ARRAYFORMULA(C22:indirect("C"&'Amplaine Auto Time Series'!ScheduleMonths+21)-SUMIF(IF(COLUMN(D22:indirect("AC"&'Amplaine Auto Time Series'!ScheduleMonths+21)),ROW(D22:indirect("AC"&'Amplaine Auto Time Series'!ScheduleMonths+21))),ROW(D22:indirect("AC"&'Amplaine Auto Time Series'!ScheduleMonths+21)),D22:indirect("AC"&'Amplaine Auto Time Series'!ScheduleMonths+21)))
The population of individual deduction fields is still a work in progress with growing requirements.

Google Spreadsheet - Time zones find text

I have a Google Form where I ask people to tick their time zone and to tick their time slot. An anser may be (each answer is given in one cell):
Time Zone = UTC+8 (Perth, Beijing, Manial, Borneo, Singapore, Taipei)
Time Slot = Morning (8am - 10am), Late Morning (10am - 12pm), Noon (12pm - 2pm), Afternoon (2pm - 4pm)
Now, I understand that having so much text instead of just a number, isn't helping any spreadsheet use, but somehow people get confused and this seems to be the only way I can get everyone to check the correct box. So in name of userfriendliness..
From these two cells I would like to calculate the time-slot into one particular time zone so I can compare them all(for example Amsterdam being UTC+1). I thought if I can use a function to lookup text, I can turn these cells into numbers.
IF cell CONTAINS "UTC+8" THEN = 8,
and doing the same for the time-slot, I can work with a modulo function or something and go ahead. But I just crossed over from Exel, and I must say Google Search isn't the same and I am a bit confused.
If you are working with local dates and times, you either need to have an offset for each and every value, or you need to use the full time zone id (not just the offset) to know what those local times represent. Simply doing math against the UTC offsets is not enough. That won't take into account all of the different rules involved with time zones, such as daylight savings / summer time.
I am not very fluent with Google Spreadsheet - but it does appear that they have some functions for time zone conversion built in. I am not sure how accurate they are, but you should review this blog post, which has some good information.

Resources