I have a datestamp in this format on A2:
18.11.2015 15:37:13
How can I split this into date and time so that I have date in A3 and time in A4?
I want to do this because datestamp does not sort properly as a number.
I found several answers to this question with various answers but none of them worked for me.
Wouldn't a simple split() be enough ? In B2:
=split(A2, " ")
Alternatively, in B2:
={INT(A2), timevalue(A2)}
Make sure to format col B as DATE and col C as TIME and see if that works?
To get the date and time in those cells you can do the following:
A3: =DATE(MID(A2,7,4),MID(A2,4,2),LEFT(A2,2))
A4: =TIMEVALUE(RIGHT(A2,8))
It's essentially extracting the essential parts for year/month/day from the string in A2 to get the needed order for date. The time is already properly formatted and can be used with Timevalue, we just need to extract the substring.
The date and time values can then be formatted in any way you want them.
Related
On this report I am trying to do some date analysis.
In column G I need to pull all the URLs from column A which have a closing date in the next 7 days.
And in column I, I need all the URLs which the closing date is in the past.
The issue is that when I try to reference the Closing dates in column E it does not read and as such work.
Could I get some help on making sheets read Column E properly and also some help on the formulas I need in Column G and I
Thank you
You might want to look at the DATEVALUE function:
=DATEVALUE(D2)
If cell D2 contains a date in the form of text (such as "26 May 2022"), this formula will return the date as a number. (You can then format the cell to display a particular date format if required.)
For URLs which have ended, you can then do:
=F2 < TODAY()
And for URLs ending in the next 7 days you will need something like:
=IF(F2<TODAY(), FALSE, IF(F2 - TODAY() > 7, FALSE, TRUE))
In column A I have date and time.
In Column B I have this formula to split them:
={"COL B","COL C"; ArrayFormula(IF(NOT(ISBLANK(A2:A)), SPLIT(A2:A, " ")))}
My sheet is linked to a Google form.
Every time a new sheet is submitted, the new data looks like 44075 and 0.9756944444 and I always need to format as Date and the other one as time.
Is there any way that my formula will automatically format the splitted value in col b and c?
You might try this:
={"Date","Time"; ArrayFormula(IF(ISBLANK(A2:A),, {DATEVALUE(A2:A),TIMEVALUE(A2:A)}))}
or this:
={"Date","Time"; ArrayFormula(IF(ISBLANK(A2:A),, {INT(A2:A),MOD(A2:A,1)}))}
In either case, you'll want to do Format>Number Date for B and Format>Number>Time for C.
UPDATE:
Since you seem to want the formatting to appear a certain way without using the Format>Number option, this will output dates and times...
=ARRAYFORMULA({"Date","Time";IF(A2:A="",,TEXT(A2:A,{"m/d/yy","h:mm am/pm"}))})
I've tried a lot of formula and surrendered.
I've just added a script:
var date = ss.getRange('R2:R');
date.setNumberFormat("MM/dd/yyyy");
var Time = ss.getRange('S2:S');
Time.setNumberFormat("hh:mm:ss AM/PM");
I am trying to query a google sheet by date. I have done some research and learned I need to convert to TEXT format so that I can run the comparison, but I am not able to get the syntax correctly:
=query('SheetName'!$A2:$S, "select A Where O=date'"&TEXT(B2,"yyyy-mm-dd")&)
Could you give me some guidance?
Some more info: in my query, B2 is a valid date in date format. Column O has some cells that are text strings and others that are valid dates; I have set the format of the entire column to "Date".
Here is a link to a simple example, feel free to play around with the query: https://docs.google.com/spreadsheets/d/1O4ms9ufvZ_CRLl_LG45hksjRoOJtv0XexbfjCLqFW4I/edit?usp=sharing
See if this works?
=filter('SheetName'!A3:A, 'SheetName'!O3:O=B2)
correct syntax should be:
=ARRAYFORMULA(QUERY(TO_TEXT(SheetName!$A2:$S),
"select Col16 where Col15 = '"&TO_TEXT(DATEVALUE(B2))&"'"))
I've already seen a lot of topics about my problem, but I can't resolve it.
Actually, I don't understand what is wrong in my formula ?
=ArrayFormula(
IF(
ISBLANK(A6:A);;SUMIFS(
Sheet1!J:J;
Sheet1!K:K; ">="&A6:A;
Sheet1!K:K;"<="& EOMONTH(A6:A;0)
)
)
)
What I'm trying to do :
Each line is a month. I want to SUM all sales made between the first day on the month, and the last one.
If I don't use ArrayFormula, it works. I dont understand how to write this formula to work with ArrayFormula.
Thank you very much for your help !
Just adding this as an answer for you,
Instead of using an array formula, I believe a query would serve you better.
as google date-time syntax is tricky we first have to convert the date value into a text and parse it as "yyyy-mm-dd" we then wrap the EOMONTH to get the last day of the month.
so we use the following formula to get the sum of the months sales:
=query(A:B;"Select sum(B)
where A <= date '"&text(eomonth(E14;0);"yyyy-mm-dd")&"'
AND A >= date '"&text(E14;"yyyy-mm-dd")&"' label sum(B) '' ";0)
hopefully, this is what you were after, apologies for the delay was on the train!
https://docs.google.com/spreadsheets/d/1ygppZZCd4b_Y_HufLwLdcynHAsa3pn6z5YXb3Poc3vk/edit?usp=sharing
I have a spreadsheet containing names and dates. I need to determine the date exactly five years after the earliest date listed for each name.
Here is the data with names/info scrubbed, and the formulas as I have them currently.
The only output I ultimately need is the Renewal Date (minimum date + 5 years). Is there a way to output that data to new rows without having to manually copy the format into column E in each new row?
Also, I'd prefer if it only outputs a Renewal Date if there is a date listed in each column. If a row is missing one (or more) dates, no Renewal Date should exist.
I have absolutely no formal Excel/Sheets training or experience, so any help is sincerely appreciated.
I duplicated the sheet in your shared spreadsheet and entered in cell E1
={"Renewal Date";ARRAYFORMULA(IF(COUNTIF(IF(B2:D<>"", ROW(B2:B)),ROW(B2:B))=3, EDATE(QUERY(TRANSPOSE(QUERY(TRANSPOSE( B2:D) , "Select "&"MIN(Col"&JOIN( ", MIN(Col",FILTER(ROW(A2:A)-1, A2:A<>"")&")"))), "Select Col2", 0),60),))}
See if that works for you?
As you mention, ColumnE is not required and the Renewal Date may be calculated with:
=ArrayFormula(if(count(B2:D2)<>3,"",edate(MIN(B2:D2),60)))
though the Arrayformula above is not achieving anything useful - the formula still has to be copied down (from Row2).