Countifs Date is between two dates Google Sheets - google-sheets

I have a cell A with the date of the beginning of the calendar week and a cell B with the end of the calendar week.
No I want to count all the rows from a different sheet that contain a date within this calendar week.
I have tried the following but it returns an error because it can't parse the formula.
=COUNTIFS('Other Sheet'!$H$1; >A2; 'Other Sheet'!$H$1; <B2)
Any advice?

Okay, so here is what worked:
You have to make sure the operands are in "" and there is a & before the relative cell reference.
You have to make sure all the date cells are formated as dates.
Then this formula worked:
=COUNTIFS('Other Sheet'!$H$1:$H; ">"&A3; 'Other Sheet'!$H$1:$H; "<"&B3)

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

Arrayformula that takes date (month and year) but ignores the formula when cell is blank

I wanted to create a simple tracker using Google sheets that automatically inputs month and year from a reference cell (date) but I need to have it ignore the formula if the reference cell is empty.
Here's what I have, can someone correct this for me?
=ARRAYFORMULA(MONTH(A1:A),IF(A1:A="",""))
try:
=ARRAYFORMULA(IF(A1:A="",,TEXT(A1:A, "mm-yyyy")))

Date comparison in query not matching when the cells being compared are date but works if cells are made into text

Sample sheet for reference: https://docs.google.com/spreadsheets/d/1P1XTAFzI1-M0zJZtKiBviSfohXcqbzaPEnxHlQ4zDSU/edit?usp=sharing
Im trying to compare one date cell to a column of date cells. I am using the query function to list out all the matching rows. Specifically I am comparing the date column in Call Log Details sheet to the date cell B2 in the EOD sheet. When I make both the column and cell in the 2 sheets to be formatted into mm/dd/yy, the function doesnt work. But when I make both the column and the cell in the 2 sheets to be formatted into Plain Text, the function works and displays the rows. I cant have the column in the Call Log Details to be Plain Text since I am adding a calendar and will be doing calculations using dates. How am I able to make the comparison to work with at least the column being a date value and if possible also the cell?
Here is the formula I am using to output the rows found in the EOD sheet at cell B2:
=query('Call Log Details'!A2:X," select T where A = '"&B1&"' order by A,B,D",0)
query understands dates only in this format:
yyyy-mm-dd
use:
=QUERY('Call Log Details'!A2:X,
"select T
where A = date '"&TEXT(B1, "yyyy-mm-dd")&"'
order by A,B,D", 0)
suggestion for column T:
={"RESERVED!!!"; ARRAYFORMULA(
{IF('Call Log Details'!E2:E="",,CHAR(10)&
"DATE : "&TEXT('Call Log Details'!A2:A+'Call Log Details'!B2:B, "m/d/yy h:m AM/PM")&CHAR(10)&
"PT: "&'Call Log Details'!D2:D&CHAR(10)&
"FROM: "&'Call Log Details'!E2:E&CHAR(10)&
"RELATION TO PATIENT: "&'Call Log Details'!F2:F&CHAR(10)&
"CALL BACK# "&'Call Log Details'!G2:G&CHAR(10)&CHAR(10)&
"MESSAGE.: "&CHAR(10)&'Call Log Details'!J2:J&CHAR(10))})}

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