Highlight Month Columns based on dates in Google Sheet - google-sheets

I would highlight, in Google Sheet, the columns of months based on dates in col AA:
dd/mm/yyyy (start date) - dd/mm/yyyy (end date).
Example:
Col AA ---> 25/05/2022 - 06/09/2022
The columns that must be highlighted: from May to September.

The best way is to change headers of column and put inside the first day of each month. Then apply a format as MMMM.
Conditionnal formatting formula:
=and(C$1>=EOMONTH($A2;-1)+1;C$1<=EOMONTH($B2;0))
if you can't change headers, the formula will be:
=and(MATCH(proper(text(index(split($AA2;" - ");1);"MMMM"));{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0)<=MATCH(B$1;{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0);MATCH(proper(text(iferror(index(split($AA2;" - ");2);"31/12/2022"*1);"MMMM"));{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0)>=MATCH(B$1;{"Gennaio";"Febbraio";"Marzo";"Aprile";"Maggio";"Giugno";"Luglio";"Agosto";"Settembre";"Ottobre";"Novembre";"Dicembre"};0))

You can try a much simpler formula:
=(EOMONTH(DATEVALUE("1/"&C$1);0)>$A2)*(DATEVALUE("1/"&C$1)<=$B2)
this works for current year.
If you want to use another year add it to string in DATEVALUE function, i.e. =DATEVALUE("1/"&C$1&"/2020")

Related

/ and - in different cells after same function

I'm trying to concatenate a column of dates and other of hours.
The fuction:
=CONCATENATE(TEXT(AGENDA!B9 ,"dd-mm-yyyy"), " ", TEXT(AGENDA!C9 ,"hh:mm:ss"))
works, but, some cells are in fuction format, dd-mm-yyyy, and some others are dd/mm/yyyy (the time is correct). I need them all with -
You have a non valid date in AGENDA sheet Fecha column note Luque, Hugo 20/08/2021 with month set to 20 !! and day is 08.
To add date validation, Select B2:B and go to Data data > validation > Criteria: date.
and select On invalid data: Show warning.
Fix the date one by one or take a look at the quick fix.
To check the date format:
Go to Formst > number > Custom date and time.
The Quick fix
To get date fixed with a formula from, mm/dd/yyyy to dd-mm-yyyy you need a helper column lets call it Fixed Date, with the formula.
=IF(ISDATE(B2)=False,CONCATENATE(INDEX(SPLIT(B2,"/-"),1,2),"-",INDEX(SPLIT(B2,"/-"),1,1),"-",INDEX(SPLIT(B2,"/-"),1,3)),B2)
Explanation
1 - IF(ISDATE(B2)=False check the date is valid if true return the original value example B2 if false calculate the formula.
2 - INDEX(SPLIT(B2,"/-"),1,2) to get the month column that resulted from SPLIT function with column set to 2.
3 - INDEX(SPLIT(B2,"/-"),1,1) to get the day column that resulted from SPLIT function with column set to 1.
4 - INDEX(SPLIT(B2,"/-"),1,3)) to get the yaer column that resulted from SPLIT function with column set to 3.
5 - CONCATENATE the columns with "-" in between.
Now you can paste your formula but adjusted in BBDD.AGENDA Sheet B3 cell.
=TEXTJOIN(" ",TRUE,TEXT(AGENDA!C2 ,"dd-mm-yyyy"),TEXT(AGENDA!D2 ,"hh:mm:ss"))
Notice that we changed AGENDA!B2 with AGENDA!C2.

Google sheets not recognising a date as a date

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

G Sheets cond column-wide formatting IF the date is in next 3 days AND it is Monday

A header
B header
C header
First
01.01.2000
something
Second
02.01.2000
something
I have a sheet with B column filled with dates.
I have 4 conditional formattings: today, tomorrow and "overmorrow" dates.
The fourth condition is the following:
Mark the cell IF its date is today()+3 AND its weekday is Monday.
The simple options "date is exactly" works for "today()+2". But it declines to works with =and() formula. It should get the date type, not a boolean.
As for the formula option, I cannot invent the right formula. This doesn't work:
=and(today()+2,weekday()=2) - I believe that, when you select a non-simple option (not like date -> is exactly) it should take the real arguments, and should not contain empty function calls like weekday().
enter image description here
You should use this custom formula: =AND(B1=today()+2,weekday(B1)=2)
Sample:
Custom formula: =AND(B1=today()+3,weekday(B1)=2)
Note: I used today()+3 temporarily just to show that the conditional formatting is working since my current day is friday.

How can I highlight cells in Google Sheets if current month?

How can I highlight cells in Google Sheets if current month?
The cells have Jan-2017, Feb-2017 etc. and not dates.
I just want the current month highlighted so that the rest of the team can keep track of our monthly stats.
I'm supposing the column that has the months is A, and that the actual values of each cell is the first day of each month (so 2/1/2017 for February for example).
Select where you want the conditional formating to go, and open the conditional formatting sidebar.
Choose "Custom Formula" from the dropdown, and paste the following in:
=$A:$A=(today()-day(today())+1)
What we are doing here is:
=A$:A$ - Look in column A for the following
today() get todays date
-day(today()) get the day and subtract it from the today in the previous point
+1 add 1 to the result because 2/8/2017 - 8 = 2/0/2017, which google sheets actually recognizes as 1/31/2017, so by adding 1 it will become 2/1/2017 which is what is wanted.
The result of this sum is then compared to the data found in A$:A$ and the results which match the sum (today()-day(today())+1) are highlighted.
Just for the record, this may work as well using conditional formatting's custom formula:
=month($A:$A)=month(today())
Considering the dates are in the column A

Google Sheets - Add range of dates based on string

Is it possible in Google sheets to have a formula which looks at a certain date and creates a range of dates based on it?
I have this google sheet:
https://drive.google.com/open?id=1ccLwh_ExEtE2zxYUor9hxi1hMyADQtuUgyCyOKASxIk
Is it possible to have formulas in the left column rows to just look at the date string "august" and automatically fill in the dates down each row? Preferably with this format I have in this sheet? Like:
monday
1
Tuesday
2
Wednesday
3
I know it's possible to format a date so it ways monday 1 e.g, but for some reason, google sheets doesn't text wrap dates and I want a line break between the day and number, if possible.
Any help truly appreciated!
Since tagged [excel-formula]:
=TEXT(WEEKDAY(DATEVALUE(1&"August"&2016)+ROW()-1),"dddd")&CHAR(10)&ROW()
in Row1 and copied down to suit should work. (For just Google Sheets this Q probably belongs on Web Applications.)
The month selection is hard-coded into the formula but could be parameterized.

Resources