I want to figure out how many dollars & cents were made or lost per minute. So for instance, if I have $10 and it took me 10 minutes (00:10:00) to acquire it, I want to know how much I made per minute:
Dollars & cents made per minute = $10 / 0:10:00
How do I implement this in google sheets?
try like this:
=A2/1440/TIMEVALUE(B2)
Convert cell A1 to minutes with: =HOUR(A1)*60+MINUTE(A1)+SECOND(A1)/60.
Related
I'm struggling with a formula in Google Sheets that will display a countdown for how much time remains until an aircraft is overdue, based on a filed flight plan.
What I have: 2 key pieces of information about a flight plan:
how much estimated time it will take to make the flight (ETE:
Estimated Time Enroute)
what time the aircraft departed (ATA: Actual Time of Departure)
Constraints: (mandated by company policy)
The ETE must be entered in decimal format, in numbers of hours. A 1hr 30min flight must have an ETE of 1.5, or a 20 minute flight must have an ETE of .3 (rounded to the nearest 10th).
The ATA must be entered in 4-digit 24hr time, but without the colon. 1:30pm must be entered as "1330"
The countdown timer must be displayed in minutes, rounded to the nearest whole number. 1hr 28min must be listed "88"
The countdown should be "live" (this is solved by spreadsheet settings to update "on update or every minute".
The countdown should easily indicate aircraft that have become "overdue" (this will be solved with conditional formatting to highlight negative numbers)
My pseudo formula is essentially just: Now() - (ETE+ATD), but I'm stuck on how to get around the constraints, specifically the three different time formats (decimal hours ETE, 4-digit 24hr time ATA, and remaining time in minutes).
I've set up a dummy sheet here:
https://docs.google.com/spreadsheets/d/165mXKRquI4aBEEap8PIHVrFpAraaapykGqjkDg22qeU/edit?usp=sharing
*I've looked through this Q&A, but it's a GAS solution. I'd much prefer to just have a formula. Preferably an array formula, so that it copies down to however many rows there might end up being.
**Possibly a secondary concern down the road: at the moment, we do not conduct overnight flights, but it's possible in the future. Starting a 3hr flight at 10pm will result in the arrival time being the next day. Hopefully, there is a solution for this.
I suggest some testing before use, but should be worth trying:
=if(now()>today()+1*(left(A2,2)&":"&right(A2,2)),round(24*60*(today()+1*(left(A2,2)&":"&right(A2,2))-now())+B2*60,0),"")
where the ATA value is in A2 and the ETE in B2.
Could be simplified but longer might be easier to adapt for overnight, if required.
How to write an interval that groups by every half a month? Rather than 1M I want something like 1/2M to group by from the first to the 16th and from the 16th to the end of the month, every month. Is there a way to do so?
I don't want to end up doing an interval on each day and then calculate manually my results as it's not clean and it would be resource hungry, is there a simple way to do so using setInterval? (in Elasticsearch or Elastica I don't care, I just want the algorithm behind it, thanks!)
$date_grp_agg = new \Elastica\Aggregation\DateHistogram('date');
$date_grp_agg->setField('date')->setFormat("MM-yy")->setInterval('1M'); // This one
Unfortunately, neither 0.5M (half month) nor 2w (2 weeks) are supported, but you could try to use a number of days, i.e. 15d.
$date_grp_agg->setField('date')->setFormat("MM-yy")->setInterval('15d');
Granted, it will not fit months perfectly, i.e. it won't start on the 1st and end on the last day of the month, but it can get you close to the kind of interval you're looking for.
I have a sheet where I record my working hours (this is more for me to remind me to stop working than anything else). For every day, I have three possible shifts - early, normal & late, and I have a formula which will sum up any times put into these columns and give me the daily total hours.
To summarise the duration of time spent working in a day, I use the following formula: =(C41-B41)+(E41-D41)+12+(G41-F41) which is:
early end time minus early start time
normal end time minus normal start time PLUS 12 hours
late end time minus late start time
Which gives me output like this:
What I cannot seem to achieve is, the ability to sum the daily totals into something which shows me the total hours worked over 1-week. If I attempt to sum the daily totals together for the example image shown, I get some wild figure such as 1487:25:00 when formatting as 'Duration' or 23:25:00 when formatted as 'Time'!
All my cells where I record the hours worked are formatted as 'Time'
When using arithmetic operations on date values in Google Sheets, it's important to remember that the internal representation of a date is numeric, and understood as the number of days since January 1, 1970.
What follows from that, is that if you want to add 12 hours to a time duration, you should not write "+12" because that will in fact add 12 days. Instead add "+12/24". In other words, try the following formula instead of the one you are using now:
=(C41-B41)+(E41-D41)+(12/24+G41-F41)
I am working on a simplified model of the stock market, and I am still learning to manage time in NetLogo. In my model a day is made of 1000 ticks. In a day several things happen: turtles sell and buy stocks, at some point during the day they set their strategies, various logs are written and then erased at the end of the day.
I would like the model to start again after 1000 ticks, i.e. at the end of the day the model does not stop but starts again, thus simulating more than one single day.
What do you suggest?
Why not just use if ticks mod 1000 = 0 [setup-locations]
I have the following question, and what I'm most confused on, is how to do the logic for determining if a check is one month late or not.
Question is:
"Write pseudocode for a program that calculates the service charge of a customer owes for writing a bad check. The program accepts a customer's name, the date the check was written (year, month and day), the current date (year, month and day), and the amount of the check in dollars and cents. The program continues until an eof value is encountered. The service charge is $20 plus 2 percent of the amount of the check, plus $5 for every month that has passed since the check was written. A check is one month late as soon as a new month starts-so a bad check written on September 30 is one month overdue on October 1."
So far what I have write now is:
Start
string Name
num AmountOwed
num DateCheckWritten
num CurrentDate
num CheckAmount
get Name, DateCheckWritten, CurrentDate, CheckAmount
while eof
Since you don't have to deal with days, the algorithm is very straightforward:
MonthsLate = (CurrentDate.Year - DateCheckWritten.Year) * 12
+ (CurrentDate.Month - DateCheckWritten.Month)
Good luck with the rest of the problem!
I'm not sure where your problem lies, but I think you have two issues to deal with:
What is the definition of late?
How many months late is this check?
So in my pseudocode, I would have a step that determines how late a check is, and then another step to calculate the fee. Inside the first step, you could just subtract the days and divide. But the directions say as soon as a new month comes along, it is one month late. So all you really have to do is subtract months.
Not sure what else you are asking, but it appears you are asking for guidance, not code. Hope this helps.
I'm going to assume this is homework, and as such I'll try to just point you in the right direction.
If you assign numbers to each month (Jan = 1, Feb = 2, etc) then the number of months between two dates is easy to determine - how many months are there between September (= 9) and May (= 5)?
The other thing to take into account is the year - for each year the check is late, you'll also have to add another twelve months. This works the same as for months.
Need any extra detail, feel free to let me know.
Simplify, hit the main points and then break it down more and more, write it how you would tell your grandma it worked.
you might start out with something like
Start
While there are more bad checks
get the service charge
add the service charge to the account
record the updates
get the service charge
charge starts at $20
add to the charge $5 multiplied by number of months