Excel Conditional Formatting date within x days - excel-2010

I have one date in C4. And I have dates calculated in Column I.
I am trying to highlight with conditional formatting any date in column I that is before the date in C4 and within the next 45 days of today.
Criteria 1: Date in Column I is sooner than date in cell C4
Criteria 2: 45 days or less from today = True
This is the formula I have so far, but can't seem to get working correctly -
=AND(C4>TODAY(), C4-TODAY()<=45)
I can get the formula to work on a single cell as follows:
=AND($C$4>$I$13, $C$4-TODAY()<=45)
I tried to copy down, but that just gets it to apply to the entire the formatting to the entire column

Solution:
=AND(I4<$C$4,ABS(I4-TODAY())<=45)
Was able to apply this range to the whole column and where you see I4, the formula would update to the relative cell. Interesting Note, I had been trying this in 2010 but in reverse (subtracting c4 from today) and was having trouble with the formula not saving without automatically adding absolute cell references.

Related

Populating columns with days based on a selection

I am trying to build a sleep tracker in Google Sheets (link). The idea is to select a year and a month from a drop-down list in cells A1 and A2, which would then populate columns based on the number of days in that month. I have tried different formulas that I found on stack overflow and elsewhere, but could not get them to work.
In short:
I am looking for a formula that will populate the columns with days of that month and a name of the day in a row bellow.
Looking for a way to summarize the time of sleep at the end of the each day, based on a ticked checkbox.
I am not sure how the year and month selectors should be formatted (as plain number or a date).
Is there a way to automatically insert check-boxes to the days of the month?
This is the formula that I have tried to adjust:
=INDEX({TEXT(SEQUENCE(1; DAY(EOMONTH(A2&"/"&A1;0)); A2&"/"&A1; 1); {"d"; "ddd"}); {"Total"; ""}})
But it returns with "Error In ARRAY_LITERAL, an Array Literal was missing values for one or more rows."
Please note that ";" is used as an argument separator instead of "," (regional settings).
Thank you in advance!
I think that with a very small adaptation and date formatting you'll be able to easily do it. First with your selector in A2, you could set it as actual dates, but format them as mmmm:
Then, repeat the sequence in both rows starting in C2 and C3:
=SEQUENCE(1,DAY(EOMONTH(A2,0)),A2)
But formatting row 3 as ddd:
PS: yes, you can do row 3 with TEXT and INDEX. Choose your preferred one:
=INDEX(TEXT(SEQUENCE(1,DAY(EOMONTH(A2,0)),A2),"dddd"))
UPDATE with TEXT VALUES
Return to your previous A2 dropdown and try this, using MATCH to find the number of the month, and DATE to locate the correct beginning of the month in that year:
For row 2:
=SEQUENCE(1,DAY(EOMONTH(DATE(A1,MATCH(A2,{"January","February","March","April","May","June","July","September","October","November","December"},0),1),0)),
DATE(A1,MATCH(A2,{"January","February","March","April","May","June","July","September","October","November","December"},0),1))
For row 3:
=INDEX(TEXT(SEQUENCE(1,DAY(EOMONTH(DATE(A1,MATCH(A2,{"January","February","March","April","May","June","July","September","October","November","December"},0),1),0)),
DATE(A1,MATCH(A2,{"January","February","March","April","May","June","July","September","October","November","December"},0),1)),"dddd")
)

Need Google Sheets formula for Number of Days with AND without end dates

I need a google sheet formula to calculate number of days on the market with my start date but my secondary cell data either has a end date assigned (no issue there) and others with no date (meaning this should default to current date). The issue I have is sheets doesn't recognize cells without an end date and I would like Sheets to recognize no cell data as current date so I get the number of current days until I enter a true end date. Please advise how to configure a simple date formula rule if possible.
I've tried =C1-D1 formula where C1 is start date and D1 is end date. This works fine for cells with end dates entered. The formula however doesn't work if I have yet to apply an end date (empty cell) and would like Sheets to recognize this empty cell as current date. In other words 0 = current date
Something like this?
=IF(D1="",TODAY(),D1)-C1

How to Auto Fill Date Column (with +30days) form Another Date Column in Google Sheet

I have 2 Columns like this
Where :
Start date is inputed by user
Finish Date is automatically filled with (Start Date + 30 days)
I have used this formula in Finish Date Column
=date(year(A:A),month(A:A),day(A:A)+30)
It works well, But the formula will work if we drag the blue box any number of cells down. I want to make it automatically filled after we input the start date. I also have read that we should use some script but I don't uderstand. Any solution? Thanks!
If you have start dates in A2:A, then array way to obtain the corresponding end date (30 days after) on each row is as follow in B2 cell.
ARRAYFORMULA(if(A2:A="","", A2:A+30))
Note: You can also put the condition like this: if(A2:A="",, A2:A+30) or just:
ARRAYFORMULA(if(LEN(A2:A),A2:A+30,))

Dynamically referencing different sheets by changing sheet range argument depending on another cell's value

[Goal]
I want to be able to have a cells with formulas (such as COUNTIFS) that can change the referencing sheet range depending on the value in another cell.
[Example sheet]
To demonstrate, I've created the below example simple Spreadsheet where it has 3 different sheets. 2 with raw data (2022 Data, 2023 Data) and another with a table that will use the both sheets' raw data.
https://docs.google.com/spreadsheets/d/1Viz3SUibpaIRu77SLwLxjfcd0ZOVmHPQpu8jTdCL92I/edit?usp=sharing
Cell A2 is for selecting the date (formatted to only show the month) and cell E4 is referencing A2 to get the date/month that was selected. D4 and all month cells adjacent to each references each other to get the incremental months.
Cell range B5:E7 is using the COUNTIFS formula to count how many emails or chats were there for that month. You'll notice that the range argument is referencing as: '2022 Data'!.
What I want to do here is to create a COUNTIFS formula with a range argument that can refer to the corresponding sheet depending on the year of that column. For example for cell B5, the month is Jan 2023, I want it to refer to the 2023 Data sheet instead of 2022 Data sheet in a dynamic way.
Obviously, I could add another COUNTIFS so that it can take 2023 Data sheet's data into consideration, however, I'd have to change the formula every time it's a new year.
Using the QUERY function as an example, I know that you can refer to a cell within the string argument if you use the double quotation and the ampersand symbol (example: "&H1&") to get out of the string. I tried doing something similar (example: '"&B4&" Data'!) but nothing worked.
[Question]
Is there somehow where I could potentially change the cell referring range dynamically depending on the value of another cell?
you can use INDIRECT:
=COUNTIFS(INDIRECT("202"&RIGHT(B4, 1)&" Data!A:A"),B4)

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

Resources