Trying to do 2 time stamps based on 2 columns - google-apps-script

I am trying to record 2 times, start and finish, based on a pick list in 2 other columns. While I can get it to update the start time stamp, I cannot get it to stamp the finish time. The spreadsheet is here:
Link to spreadsheet
If anybody can see what I'm doing wrong, please feel free to point it out.

Related

Prevent Double Booking on Google Form/Conflict

Can anyone help me write a Google App script for the Google Form I made?
In my form I have 4 questions. 1. Name, 2. Email, 3.
Phone Number, and 4. is Select Time for... But in the Form Responses 1 sheet the column for the answer for #4 I moved it to the second column next to the timestamp.
In number 4 I used a dropdown list for answers. Listing time from 8:00AM-12PM with 20
minutes interval. For example, 8:00 AM, 8:20 AM, 8:40 AM, and so on.
I created this form to serve as a booking form. What I want to happen is
I don't want people to have the same answer in question #4.
If they do, that means they can book at the same time.

Google Sheets - Track and Log highest and lowest value of other (dynamic) cell

I am trying to build a sheet for paper trading Stocks and Crypto. The values in A are refreshed every 5 minutes. In B, I have the current Date and Time. At the moment, I have a workaround that sends a mail if a value meets a certain criteria. But it is not ideal. Another workaround would be to log every API request of a value as historical. But that would take every 5 minutes 2000 rows. I would like to log the values of a couple specified rows (trades). The Highest Value and Lowest value and the Timestamp of the logged value. Is there a way? I included a picture of how I would see it. I tried Google and the search within Stack Overflow without any result. The timestamp is a Bonus, the Log is the most important. I think it could be done within the App Script. But not sure.
Example:
Put the Question on Freelacer.com . This is the code i was looking for : Code added as picture enter image description here

Automatic Average For X Most Recent Column Entries

I have a sheet where someone enters numbers into a column every week
Is there a way to have a column that automatically shows the average of the x most recent weeks entered?
So when a new week is entered, the average formula automatically changes the range of columns used for that average
Or possibly via script if needed?
e.g. After the user fills in the new week, I could have them run a script in the sheet to recalculate the average.
Any hints are appreciated.
Not sure how to word a search to look for examples.
And the winner seems to be AVERAGE & OFFSET
This gives me the average for the last 5 entries in the 2nd row
=AVERAGE(OFFSET(C2,0,COUNT(C2:AQ2)-5,1,5))

Time Trigger Copy Paste

I'm fairly new to Google scripts and so far I only have a functional understanding of 'onEdit'. I want to incorporate Google's time triggers however I don't know how to do it due to lack of understanding.
Here is what I am trying to do:
Objective: Create a spreadsheet that keeps track of metrics on a weekly basis
Current Set up: Currently, the spreadsheet uses 'CountIF' on a queried spreadsheet from multiple users to compile all the data and determine the status of every to-do item at any moment.
Need: I would like to set up a script that takes affect every Sunday. The script would copy the metrics from the previous week and paste them into a row below based upon the start date and date date of the previous week (Which are kept in columns A ad B...Ex: 7/7/2018 & 7/14/2018. If the previous week falls into this date range, the cumulative metrics for that week will paste into columns C-L of that week.
Essentially, row 3 would always keep the running total and then the rows below row 3 would populate with a "total to date" for the given date range.
In your Apps Script editor go to Edit > Current Projects Triggers and select Time Driven > Week Timer.

MYSQL Time Comparison Range

I'm trying to help a taxi company. The problem is that they have a credit card machine that takes payments, and has its own database entries, and there is a completely separate database that has a list of entries such as pick up time, and drop off time.
I need to match the database of trip entries to the credit card purchases, and the only way to do this is by matching which vehicle is running the transaction, and looking for a time CLOSE TO the DROP OFF time and see if it's a match. It's not ideal.
So, I am trying to compare two times in yy-mm-dd hh:mm:ss format. They need to be plus or minus 5 minutes of each other. How do I do this in MYSQL?
I thought SubTime and Addtime would work, and it seemed to, but then I got wierd results.
SELECT * FROM completedtrans WHERE DrivID = 128 AND TransTime BETWEEN SUBTIME('2013-06-20 16:53:06', '0 00:05:00') AND ADDTIME('2013-06-20 16:53:06', '0 00:05:00')
Here's an example of one of my searches. Can anyone tell me what's wrong with it? It's supposed to search 5 minutes before and after that particular given time. I can't simply write the time, because the query is automatically generated through php code.