Conditional formatting for column of dates - function

I have a date column. I want to highlight each date that is 90 days old or older in Column "C". For single cells it's easy using Date is before, exact date, and then:
=TODAY()-90
but for the entire column I struggle to find how to insert the function so it keeps working for all cells. I tried something like Date is before, exact date, and:
=ARRAYFORMULA(TODAY()-90>C2:C200))
Sadly, this does not work. Any suggestions?

Please try:
=and(today()-C1>90,C1<>"")
as "Custom formula is" with formatting of your choice and Range: C:C (or to suit).
The 'engine' is today()-C1>90 but this is wrapped above in an and so blank cells are not also formatted by the rule.
Applies to New Google Sheets.

Related

How can I change a custom date into numbers in Google spreadsheet?

I want to do a vlookup/sumif based on dates
How can I do it? I saw from a source I have to first change it into numbers
Somehow I cannot do it with formulas like value/Datevalue, I can only convert it by changing its format.
Spreadsheet image
The vlookup() and sumif() functions work fine with dates and date time values.
With vlookup(), you can get an exact match of a date time value by setting the is_sorted parameter to false. To match the first value that is less than or equal to a date time, make sure that the data range is sorted, and set that parameter to true.
With sumif(), if you need to remove the time component from a date time value to match dates to date times, use datevalue().
See this answer for an explanation of how dates and times work in spreadsheets.

Setting array formula until last column in Google Sheets

I have a formula as follows in google sheets:
=ARRAYFORMULA(IF(LEN(F2:F),IFERROR(SPLIT(REPT("PAID ",F2:F)&REPT("- ",(24-F2:F))," ")),))
This formula will show paid according to number of paid in the cell and show "-" to the cells in the rest column. For now, this formula is only applicable for columns. I dont want like that, I want this formula to be used until the last column because the number of columns will be increased every year. I dont know whether this should be done in Google App Script or what. Anything should be fine to solve my problems. I have attached some images to explain myself clearly. Thanks in advance.
https://docs.google.com/spreadsheets/d/1bM8l6JefFsPrlJnTWf56wOhnuSjdIwg3hMbY1tN1Zp8/edit#gid=1775459006 - Link to google sheets
I will use the sheet "JALAN SANGGUL 4" as an example. Then you will need to apply to all of the other sheets that have the same structure.
Replace your current G1 formula with this:
=TRANSPOSE(FILTER(Configuration!P2:P,Configuration!P2:P<>""))
Replace your current G2 formula with this:
=ARRAYFORMULA(IF(LEN(F2:F),IFERROR(SPLIT(REPT("PAID ",F2:F)&REPT("- ",(COUNTA(FILTER(G1:1,G1:1<>""))-F2:F))," ",1,1)),))
The added FILTER in each constrains things to only areas where data exists. By counting where only data exists instead of using a set "24" in the second REPT clause, you'll always get dashes going only as far as there are months in Row 1.

How do I split this datestamp in Google Sheets

I have a datestamp in this format on C6:
21/05/2021 10:41:35 PM
How can I split this into date and time so that I have date in D6 and time in E6?
I want to do this because I have browsing history I want to import to calendar.
I found several answers to this question with various answers but none of them worked for me.
You can use SPLIT(C6, " ") to split contents of the cell.
This splits the time and AM/PM too, but you can join it in another cell using JOIN(" ", E6:F6)
date in Google Sheets is always an integer, and time is a fractional number, so you can divide the date and time very easily
Since your data comes from an imported .csv file, it could be formatted as text.
If that is the case, try the following formula
=SPLIT(REGEXREPLACE(A1,"(.*\/\d+) ","$1#"),"#")
You can then format the results to your liking.
(As always, do adjust ranges and locale as needed)
Here is a simple option that you can use as long as each datestamp is exactly the same:
Use the LEFT() and RIGHT() functions. (These also work in Excel)
For the date, use LEFT(DATESTAMP_CELL,10). This will return the first 10 characters from the cell, which in this case are the date "21/05/2021".
For the time, use RIGHT(DATESTAMP_CELL,11). This will return the last 11 characters from the cell, which in this case are the time "10:41:35 PM".
This should be the result:

Is there a way to use one worksheet as database to create a code based on the date?

I am currently working on a spreadsheet formula where 2 different codes would be generated. Here is the algorithm for the "code" to start with., but I don't know how to construct a proper excel function for it.
There are 10 digits to the code where the first 8 digits are just the date i.e. 20210328_ _
The final 2 digits are dependent on the previous records whether there are records with the same date. If so it would assign a two-digit number starting from 1 to differentiate the different records.
I have tried to use the below formula to achieve what I want but the part where it references the other spreadsheet is bothering me as I need it to be a flexible value where the value is referring to the last row of the spreadsheet. Is there a way to work around this without scripts? I am planning to deploy it on Google Sheets so App scripts solutions would also be workable but not preferable.
=IF(DAY(B2)=RIGHT(Data!A114,2),Data!A114+1,CONCATENATE(YEAR(TODAY()),TEXT(B2,"MM"),DAY(TODAY()),"01"))
FYI B2 is the date of input and Data!A114 is the part where I concern.
Here's what I came up with.
Formula(D3)=IF((TO_PURE_NUMBER(Concatenate(YEAR(A3), TEXT(A3,"MM"),DAY(A3))) - TO_PURE_NUMBER(Concatenate(YEAR(A2),TEXT(A2,"MM"),DAY(A2)))), (TO_PURE_NUMBER(CONCATENATE(TO_PURE_NUMBER(Concatenate(YEAR(A3), TEXT(A3,"MM"),DAY(A3))), "00"))) ,(D2+1))
The data for the dates starts in A3, and continues down.
Link to the Google Sheet I tried it on.
https://docs.google.com/spreadsheets/d/1bwukKFaEow4PysqcJLA9jqjKBLZcY8T1vTN5VpZo8F8/edit?usp=sharing
Let me know if this worked.

How to highlight cell if date format is incorrect or blank?

I have an excel sheet with over 5000+ records.
I am trying to set the date column into correct format (dd/mm/yy)
Instead of visually looking at data to spot errors such as:
Blanks
Date inputted like this: 27//01/20 < notice the double //
Or something like this: 27/01/20.. < notice the full stops
Is there an easier way of finding errors in date column?
Here is a sample of my column A:
1st and 4th row should be marked in red, because it is not correct format.
Reason I want to achieve is this is because I am needing to import it into MySQL with correct column types. Not all to be varchar.
Use conditional formatting - choose rule type 'Use formula...', enter formula =NOT(ISNUMBER($A10)) for appropriate range and get red cells.