I'm trying to apply a duration format to some cells in google spreadsheet. I would like to convert an integer number in a format: X days x hours x minutes.
I've tried with some formats like: d:h:mm but i found a problem when I apply the format. It always put one day less. When I write 1 in the cell the convert to 31:0:00. When I write 2 the cells changes to 1:00:00.
That is because the duration format is actually a date / time format (for comparing dates).
If you simply enter a number (1) google will interpret that as midnight (as times are stored as fractions of whole days) of the reference day number 1.
Reference day in Google Sheets is 31/12/1899 - IE the 31st day of the month. That is why your result returns days=31.
To achieve what you want you effectively want to add 1 to your values. so that 1 (+1) actually becomes "2 days since 31/12/1899 - ie 01/01/1900 - ie 1 day, and you could then use custom format for display, but this wont work when you have >31 days.
I think the best way is to simply concatenate the data you have with relavent parts like so (where A1 is a cell containg your data - 1,2,1.5 etc):
=int(A1)&" days "&int(MOD(A1,1)*24)&" hours " & mod(MOD(A1,1)*24,1)*60 & " minutes"
Related
I'm trying to conditionally format a column, if the date/time value in the column D is less than 4 hours old, turns yellow. The custom formula I tried is this. Trying to search for solution but cant find much on it
Column D is formatted as "8/23 7:00"
=IF(timevalue($D$2)<NOW()-4)
Tried a different approach that didnt work
=isbetween(now(), now() - 1 / 24)
Also tried
enter image description here
is less than
=now() - 4 / 24
this worked, sheets was lagging to reflect the format
For 1 Month low: I tried this Code in Google Sheet does not working
enter code here
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY())), TODAY()),0,2))
Does not returning any value
When entered into Google sheets your formula comes up with the following error message:
"Wrong number of arguments to DATE. Expected 3 arguments, but received 2 arguments."
Looking at the formula there are a number of issues -
The date function is being fed three elements, but they do not make up a correct date. The function is being fed the month value twice instead of a year, month, day value.
So
=DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY()))
should be
=DATE(year(TODAY()),MONTH(TODAY()-30),DAY(TODAY()))
In your original formula there is also a ) bracket missing as part of the year element of the date formula, so the formula wasen't returning the right number of elements.
When viewing the Google Docs editors help file webpage, if your intention is to return the low value of a stock, you are also using the incorrect attribute element to pull this value out. You have used "price" which returns
‘price’ – Real-time price quote, delayed by up to 20 minutes.
but should be using
'low' – The current day's low price.
Again referancing the Google Docs editors help file webpage you can also shorten your date element to only use the TODAY()-30 element instead of entering the a full date string.
As such your origional formula can be changed from:
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",DATE(MONTH(TODAY()-30,MONTH(TODAY()),DAY(TODAY())), TODAY()),0,2))
to
=MIN(INDEX(GOOGLEFINANCE("NYSE:UBER","price",MONTH(TODAY()-30), TODAY()),0,2))
I'm rather new to google sheets, and I'm trying to make a timesheet that will calculate hours and minutes automatically. The problem I'm facing is that the formula always returns a "#VALUE!"-error because "23:15 is a text and cannot be coerced to a number".
I've formatted the cells to time, but it won't recognize the input as hours and minutes. What am I doing wrong here?
It happened to me too, I discovered that you have to change the location:
File > Spreadsheet Setting > Locale > United Kingdom
you will see that now you can type your time correctly with the ":"
Try going to Format, Number, More Formats, More Date time formats.Select Hour Minute (13:30). Apply this format to all columns (or cells) involved in the calculation.
Here is a copy of my test spreadsheet. I can't get yours to work(?), but this does:
https://docs.google.com/spreadsheets/d/1Qg1JJU9MELesqllHFOhKFO-jxDf1fJMiIVznU1vNP0w/edit?usp=sharing
It is set to your country.
In Google Spreadsheets I have a column of various dates (these are employee's start dates). I want the cells to be highlighted when today's day is within a week of these employee start dates.
I have already been playing with =(B4-TODAY())>7 but this seems to highlight all the past dates.
If this is not possible, just being able to highlight this month's dates is fine (which is easy to do in Excel but can't seem to figure out in Google Spreadsheets).
Then, once this has been done, I have another column with a drop box selection with DONE, and, PENDING.
I would like to conditionally format it so that when DONE is clicked, the highlighted start dates in this month (or 7 days before the day) are highlighted in a different colour.
So it can easily be seen that in 1 week employees are coming, and when done is clicked, we can see their administrative stuff has been dealt with.
Please try =B1="DONE" for the alternative colour and for the +/-7 days:
=and(A1<today()+7,A1>today()-7)
in that order.
=and(…) is used in one of the formulae because the relevant condition is for a bounded range. When I enter =today() in Google Spreadsheets and change that cell’s format to Number I see 41,845.00. Since one week either side makes up the ‘band’ to which attention is to be drawn the relevant values for CF are everything from and including 41,838 to 41,852.
But for display purposes I switch to one day either side, rather than one week, and leave off 41840 throughout, so today becomes represented by 5, and the reduced range of interest therefore 4 to 6 (both inclusive). Of all the possibilities, any value up to and including 3, and 7 or greater, is to be ignored for CF:
The range of interest is everything less than 7 (green) that is also more than 3 (blue):
For “that is also” Google prefers and. In case of any remaining uncertainty creating your own example with a week either side of 41845 etc may help.
I'd like to process the following columns in a google-spreadsheet. The Time column represents the minutes, second and milliseconds take to run 1km and I'd like to be able to sum the four values.
Split Time
1 3:13:4
2 3:20:5
3 3:16:1
4 3:26:3
I suspect that I need to convert and split the time column into a specific minute and second columns to achieve this goal but would appreciate any advise that the developer may have.
I updated the format of the time column and used the SPLIT / CONTINUE functions
Minutes=SPLIT(B2,":")
Seconds=CONTINUE(C2,1,2)
Total Seconds=(C2*60)+D2
The table now looks like
Split Time minutes Seconds Total Seconds
1 03:13:00 3 13 193
2 03:15:00 3 15 195
3 03:16:00 3 16 196
Still wondering about the most efficient way to convert the Total Seconds value to time.
You can use the LEFT(text, number), MID(text, start, number), and RIGHT(text, number).
In detail:
Minutes = LEFT(B2, 1)
Seconds = MID(B2, 3, 2)
Milliseconds = RIGHT(B2, 2)
You can just use SUM for those values, a la:
=SUM(A1:A4)
Alternatively, you can use functions such as HOUR, MINUTE and SECOND to extract appropriate values if you want more fine-grained control.
Where the source data is a specified (ie The Time column represents the minutes,second and milli seconds) then to be able to add to a sensible result (795.013 seconds for the first sample of four) conversion similar to:
=60*index(split(B2,":"),0,1)+index(split(B2,":"),0,2)+index(split(B2,":"),0,3)/1000
is required.
To convert the total (assumed to be in C6) to the same absurd format as for input (13:15:13):
=int(C6/60)&":"&int(mod(C6,60))&":"&value(mid(C6,find(".",C6)+1,3))
`
In your original sheet, in a new column:
=TO_DATE("00:0" & left($B2,4))
Then copy the formula down the column.
This will convert your M:SS (the left 4 characters of your data) to the sheet's system date/time format, for each entry in column B.
You can then sum and format the results as you like.
This assumes there are no leading zeroes on your data. You can add code to check for this, but if your times all have single digits for the minutes value, it won't matter.