Im having trouble adding AM/PM in my formula in google sheet
This is my formula
=IF(ISDATE(H7),TEXT(NOW(),"h:mm"),"nt")
If you seend the format of NOW() is h:mm that gives you time only like 10:00
Now how can I add AM/PM after h:mm
How about this modified formula?
Modified formula:
=IF(ISDATE(H7),TEXT(NOW(),"h:mm AM/PM"),"nt")
Official document says as follows.
AM/PM for displaying hours based on a 12-hour clock and showing AM or PM depending on the time of day.
When it's 2020/07/27 15:00:00, above formula returns 3:00 PM.
Reference:
TEXT
Related
I have a link in my Google Sheet to create a Google Calendar entry for the item:
=HYPERLINK("https://calendar.google.com/calendar/render?action=TEMPLATE&text="&A7&"&dates="&B7&"&details=&location=","Add to Calendar")
The date format in B7 the cell is DD-MMM-YYYY for example 13-Jan-2022
I have seen the format for the link needs to be:
YYYYMMDDTHHmmSSZ/YYYYMMDDTHHmmSSZ
How can I convert the date for it to work as an all-day item, not a set time?
Thank you!
You have to convert the dates in GMT Greenwich Mean Time
format: YYYYMMDDTHHmmSSZ/YYYYMMDDTHHmmSSZ
EXAMPLE 20220113120000Z/20220113130000Z
Try
=HYPERLINK("https://calendar.google.com/calendar/render?action=TEMPLATE&text="&A7&"&dates="&text(B7,"YYYYMMDDTHHmmSS")&"Z/"&text(B7,"YYYYMMDDTHHmmSS")&"Z&details=&location=","Add to Calendar")
edit
with GMT correction
=HYPERLINK("https://calendar.google.com/calendar/render?action=TEMPLATE&text="&A2&"&dates="&text(B2-value(substitute(substitute(D2,"+",""),"GMT",""))/24,"YYYYMMDDTHHmmSS")&"Z/"&text(C2-value(substitute(substitute(D2,"+",""),"GMT",""))/24,"YYYYMMDDTHHmmSS")&"Z&details=&location=","Add to Calendar")
I have a column with dates and time formatted like this in each cell:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
I want to split this across two columns so that the first column has "DD/MM/YY" and the second has the timeslot.
So it would go from being a cell with:
Thursday, Jan 21, 2021 4:30 PM-5:00 PM
to two cells:
21/01/21 4:30 PM-5:00 PM
What formula can I use in Google Sheets to achieve this?
Another suggestion (which assumes here that your raw data runs A2:A):
=ArrayFormula(IF(A2:A="",,SPLIT(REGEXREPLACE(A2:A,"^\w+, (.+\d) (\d.+$)","$1~$2"),"~")))
This will leave your dates in the first column as numeric raw dates rather than as text, so you'd be able to use them in calculations and comparisons later. Just select the first column of the results (i.e., those raw dates, showing as numbers in th 40000 range) and format the entire column (Format > Number) in the date format you prefer.
use:
=INDEX(IFNA(TEXT({REGEXEXTRACT(A1:A, ", (.+\d{4})")*1,
REGEXEXTRACT(A1:A, "\d{4} (.+)")}, {"dd/mm/yyyy", "#"})))
I have the following code which I'm using in my Google Spreadsheet.
=ArrayFormula(sumif(month(income!A$2:A), month(A2) , income!B$2:B))
There are two sheets, main and income.
Income sheet contains payments received in every month. (there are multiple payments in each month). So I sum up earnings in a month and display them as monthly earning in main sheet.
The problem is - since it only considers month, when we have april 2014 and april 2015, the total sum for april in main sheet counts both years.
I am trying to figure out how to use year+month in the formula. Any help?
I just figured it out using the TEXT function.
Here's what I did:
=ArrayFormula(sumif(text(income!A$2:A, "mmm yyyy"), text(A2, "mmm yyyy") , income!B$2:B))
The first value in sumif is this:
text(income!A$2:A, "mmm yyyy")
It basically fetches month and year from all rows in column A in income sheet.
The second value is:
text(A2, "mmm yyyy")
It fetches month and year from A2 cell in main sheet.
Those two are compared. And we get the result. Problem solved.
Normally, when I enter times in Google spreadsheet as 22:00:00 the display automatically switches to 10:00 PMbut sometimes it's not converting.
How can I set a common format for times in Google spreadsheet? I need this format: 8:00 PM.
Select all ranges that you wish to have this time format and go to Format > Number > More formats to select the one of your choice. (I think the one you want is near the bottom and shows as 3:59 PM.)
If you want to format a time with TEXT() to display with am/pm you can use:
=TEXT(DateField, "HAM/PM")
To get a results like
1am
1pm
10pm
12am
Use UPPER() to make it uppercase.
How to use a formula to determine the current timezone?
The formula I use gives an unexpected result.
My spreadsheet settings (File > Spreadsheet settings...):
Time zone: (GMT+01:00) Amsterdam
The formula I used:
=TEXT(NOW(),"HH:mm z")
This gives:
12:47 GMT
Local clock time is 12:47, I would expect the formula to show: "12:47 GMT+1".
I also tried Z instead of z, which gives "12:47 +0000", I would expect +1.
Any suggestions?
I need this so I can determine UTC time and convert to Epoch time ("UTC time" - DATE(1970,1,1)*24*60*60)
You can't do that using formulas w/o javascript checking your local timezone.
As per this form:
https://docs.google.com/a/codeproject.com/spreadsheet/ccc?key=0AqhqY231XZd3cFBiY2VqeWdmNWdaX25zN2lpekthQlE&hl=en_US#gid=4
timezone formatting stuff is not supported in TEXT. This spreadsheet was done by one of Stackoverflow contributors, it is not mine.
So... script?
=TEXT( NOW()+x/24 , "DD/MM/YYYY HH:mm:ss" )
=TEXT( NOW()+8/24 , "DD/MM/YYYY HH:mm:ss" )
The (+x/24) after the NOW function will add x hours (in my case 8) to the standard time. NOW()+1 will give you the time tomorrow so working bakc or forward you can set the formula to give different time zones.
Hope this helps,
Robbie