Google sheets time formatting won't work for me - time

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.

Related

DAX ignore row context in measure. Calculate for a defined set of dates and show the value for all dates in visual

I am trying to create a measure which calculates the average daily revenue per customer, but only using days in a 6 months period prior to a specific date (where some type of conversion happens).
This specific date can be different for each customer.
The intention is to use the measure as a baseline for indexing daily average in the days/months/years after said conversion date.
If I put my current version of the measure in a card it works just fine (circled in green). But I will eventually have to visualize this over time as well. Thus I need the value to stay the same regardless of the row/date context in a table or timeline (circled in orange).
I suspect I need to use one of the ALL/ALLSELECTED/ALLEXCEPT filter modifiers but I can't really get anything to work.
The measure looks like this for now:
Average daily rev before conversion = CALCULATE (
AVERAGEX(
VALUES('Date'[Date]),
[HI & Acc Rev]
),
FILTER('poc vFact_SalesLine','poc vFact_SalesLine'[OrderDate_ID] IN DATESINPERIOD('Date'[Date],FIRSTNONBLANK('poc vDim_Customer'[DSE first conversion date],1),-6,MONTH)))
I've tried adding REMOVEFILTERS('Date'[Date]) just before the filtering of order dates, but that doesn't work. Gives me the exact same values as shown below.
All help is very welcome? Is my approach all wrong?

Get 1 Month low price of a stock with Google Finance using Google Sheets

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))

Changing format of date without using to_char - Oracle

I have to get the max payment date on an invoice and I am having trouble with the date format. I do not need the max in this formula as I am using the format in a reporting tool that is pulling the max from what it finds for me.
Using "to_char({datefield},'mm/dd/yyyy')" works for displaying that date the way we would like BUT when you use summary function MAX it does not pull the correct date because it is looking at a string and not a date (it will think 12/3/21 is larger than 3/2/22).
Another thing I have tried is trunc - "trunc({datefield})" which gives us the correct max date but it changes the formatting. For example if the date prior to the formula being applied is "8/12/21 12:00:00:000" the trunc formula will display it as 12-08-21 which is horribly wrong.
Long story short is I need a way to change a date/time to date with the format of 'mmmm/dd/yyyy' WITHOUT converting it to a string with something like to_char. Thank you!!!!
A DATE is a binary data type consisting of 7 bytes representing: century, year-of-century, month, day, hour, minute and second. It ALWAYS has all of those components and it is NEVER stored with any (human-readable) format.
What you are seeing when a date is displayed is the client application you are using to access the database making a decision to be helpful to you, the user, and display the binary DATE provided by the database in a human-readable format.
If you want to change how the DATE is displayed then you either need to:
Change the settings on the client application that controls how it formats dates when it displays them to you; or
Change the data-type so that it is no longer a DATE (which does not have a format) to a data type where the values of the date can be formatted (such as a string). You can do this using TO_CHAR.
If you want to find the maximum then do it BEFORE applying the formatting:
SELECT TO_CHAR(MAX({datefield}),'mm/dd/yyyy')
FROM your_table;

Can't get WORKDAY function to work with a COUNTIF

Trying to work on a system at work that will tell how many error codes were registered by a particular machine on the previous workday. This spreadsheet will need to be able to select only the errors generated on the previous date as this will become a rolling list of data generated across a wide time span. Currently working with the formula
=TODAY(),-1,B2:B17)
where the last array is some shutdown days I've put in to generate a global variable "Yesterday" and trying to use the formula
=COUNTIF(Table1[DateOnly],"="&Yesterday)
to gather the number of records that occurred yesterday.
Can anyone tell me where I'm going wrong?
Found that the issue was when I tried to convert the timestamp in mm/dd/yy hh:mm:ss format to mm/dd/yy and didn't realize that the other information was still hiding in there and confusing the formula. One of my coworkers recommended the use of a ROUNDDOWN function in the use of =ROUNDDOWN(argument,0) to get rid of the time information and just leave me with date.

Duration format in google spreadsheet

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"

Resources