Using Countifs to get the number of items in a date range - google-sheets

I am using Google Sheets to give me the total number of candidates being recruited from different sites in a date range. I am getting a formula parse error from:
=COUNTIFS('Candidates being recruited'!$G$2:$G$1000,$A4,'Candidates being recruited'!$K$2:$K$1000">11/1/2015",'Candidates being recruited'!$K$2:$K$1000"<11/7/2015")
Candidates being recruited is the tab I am pulling from.
$G$2:$G$1000 is the site listings
$A4 is the specific site name
$K$2:$K$1000" is the date column
then I am listing the date range I am looking for.
What am I not seeing?

You didn't put a comma between the second and third range and condition as it needs the two and can't take an array of TRUE/FALSE values.
This formula approach with Candidates being recruited'!$K$2:$K$1000">11/1/2015" would be possible with array formulas but unnecessarily verbose.
Try
=COUNTIFS('Candidates being recruited'!$G$2:$G$1000,$A4,
'Candidates being recruited'!$K$2:$K$1000,">11/1/2015",
'Candidates being recruited'!$K$2:$K$1000,"<11/7/2015")

Related

Sheets: Index & Match string, search Column, + Countif dates in the future

I am using google sheets, and trying to create a small table that shows me how many events for a single location (city) are currently on sale.
The method I'm using, is trying to search for a string in cell reference "A3" in sheet2 row 2, then count the date values in that column that are in the future.
What I thought would work this way was;
=COUNTIFS(INDEX(MATCH($A3,TestMes!$A2:2,0),TestMes!5:100,0)), ">"&TODAY()
I have included an example here that anyone is welcome to edit;
https://docs.google.com/spreadsheets/d/1a2rqWaYNzb2xphnv1RZOoEsKoYBRhJHdJTmIp9EGiSY/edit?usp=sharing
Where;
COUNTIFS counts the number of cells in the range which are greater than today (ie; future)
INDEX is the range of the column where;
MATCH has searched the second row in the second sheet to identify which column to index, then Counts all the dates within that column that are also within the range 5:100,
and finally outputs a count of the current live dates.
I'm getting a formula parse error, have watched 3 20 minute youtube videos, and tried all manner of combinations, im totally stumped.
Am I overcomplicating the formula?
Added formula(s) to your sheet:
=COUNTIF(IFNA(FILTER(Sheet2!$5:$100,Sheet2!$A$2:$2=$A3)),">"&TODAY())
=BYROW(A3:A,LAMBDA(z,IF(z="",,COUNTIF(IFNA(FILTER(Sheet2!5:100,Sheet2!A2:2=z)),">"&TODAY()))))

Why does a different result show up when filtering a date in google sheets?

I'm very new to programming so I'm not sure how to phrase this but in google sheets, I'm having a problem:
when filtering results using =IFERROR(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5)), it works perfectly fine with letters and numbers but when there's a date in Segment Management cell B5 it instead of saying the date (in this case 15/3/2020) it outputs "43906". Could I get some help to explain why it says this number instead of the date?
Date is considered as plain number in google sheets that's the reason you get numbers instead of date you can either do either of one
Select the column where you have put formula & in menu Format> Number> and select date formatting
OR
use this formula =ARRAYFORMULA(TEXT(FILTER('Segment Management'!B:B,'Segment Management'!A:A=B5),"DD/MM/YYYY"))

How do I get the range of holidays for NETWORKDAYS from a LOOKUP?

I am trying to grab a list of holidays from another sheet using an HLOOKUP to find the appropriate row based on country to get a list of holidays for the NETWORKDAYS function. However, when I try to do this I simply get a #REF error that says HLOOKUP evaluates to an out of bounds range.
I have a sheet called Billable Days that has a list of holidays based on country. Cells J14:N14 contains the country, and in a list below that is a bunch of holiday dates. They are varying ranges. For example, the US holidays range from J15:J32.
In a different sheet, I need to pull the correct holidays based on the country in column R into a NETWORKDAYS function.
First I tried:
=NETWORKDAYS(B2,S1,HLOOKUP($R2,'Billable Days'!$J$14:$N$14,15:50,FALSE))
This gives me an #VALUE error saying: "An array value could not be found"
Then I tried:
=NETWORKDAYS(B2,S1,ArrayFormula(HLOOKUP($R2,'Billable Days'!$J$14:$N$14,15:50,FALSE)))
Which gives another value error.
Finally, I tried
=NETWORKDAYS(B2,S1,ArrayFormula(HLOOKUP($R2,'Billable Days'!$J$14:$N$14,{15,16,17},FALSE)))
Just to test it out to see if I could get any values, and got a #REF error that said "HLOOKUP evaluates to an out of bounds range"
Can anyone help me craft this function? I'm not even sure if HLOOKUP is the way to go here, but it was the only way that came to mind.
EDIT
For clarity and as requested, I created a sheet to demonstrate what I mean. Find it here.
You will see the Consultants and Billable Days sheets. You can see the function I wrote to calculate the NETWORKDAYS based on the start and end date. However, in that function I want to add the appropriate list of holidays from the Billable Days sheet to the NETWORKDAYS function as the third parameter. I need something that looks at the country column and finds the appropriate holiday dates from the Billable Days spreadsheet, then inserts it into the NETWORKDAYS calls. I cannot figure out how to accomplish this.
Here is how to construct what you wish.
On the consultants sheet in L2 I placed =address(2,match(E2, 'Billable Days'!$A$1:$F$1,0)), which finds the column index of the desired country and construct a proper cell name for it with row B. Then in M2 I say ="'Billable Days'!"&L2&":"&mid(L2,2,1) to construct a string referring to the desired holiday range, like 'Billable Days'!$B$2:B. Columns L and M can be dragged down for all the people. Then when you want the holiday list for the consultant in the second row say =INDIRECT(M2) or in the 5th row =INDIRECT(M5), or if you are building it into another formula, drop the = sign. You could clean it up a little to be graceful when the country is not found, or possibly to make an ArrayFormula and avoid the dragging.

When using SUMIF function, is there a way to accept timestamp values (e.g. 2/12/2019 19:56:16) as the range to test against the criteria?

I'm working with two columns,
column A: a list of timestamps
column B: a list of numbers
I'm trying to use the sumif(range, criteria, [sum range]) function to check if the month in column A is January, and so on for all months.
The issue is that I need a way to either convert the range for the sumif to month names, or use criteria other than a string (because a timestamp isn't going to ever be "=January".
My thought was that I could do either
=sumif(TEXT(TO_DATE(A2:A),"mmmm"), "=January", B2:B)
or
=sumif(A2:A, TEXT(TO_DATE(A2:A),"mmmm")="January", B2:B)
these are more or less pseudo-code, I'm trying to convey my thought process
I understand I could create a new column that converts the timestamps into months, but is there anyway I can preform this sumif, without having to make a new column?
Using SUMIFS, with dates you set the extents, this works in excel and google sheets:
=SUMIFS(B:B,A:A,">=" & DATE(2019,1,1),A:A,"<" & DATE(2019,2,1))
With Google Sheets you can also use filter:
=SUM(FILTER(B:B,MONTH(A:A)=1))
"=2" = February, "=3" = March, etc.
=ARRAYFORMULA(SUMIF(MONTH(A2:A), "=2", B2:B))
if you want to select it from a drop-down menu use:
=ARRAYFORMULA(SUMIF(MONTH(A2:A), "="&MONTH(F2&1), B2:B))

Google query function

I am trying to return multiple records from a logbook into a final monthly statement... I'm using the query function but I do not get multiple records, it only displays the first match.
My sheets are from 1-31 for days of the month, then the last sheet labeled 717 is for Unit #717's monthly statement.
On Sheet 717, I would like to display information from sheets 1 through 31. Where column A=717, display values from columns B,C,D. Currently, it will only show me the first match. The amount column should show the corresponding rate for that row.
I hope my explanation is not confusing, any help is much appreciated. Thanks.
Here is a link to sample spreadsheet.
As you are concatenating the output of QUERY functions, you are actually performing an "array calculation", and you'll need use an "array calculation enabler", otherwise you will indeed only get the first applicable result.
=ArrayFormula(QUERY('1'!A3:G60;"select B where A=717")&QUERY('1'!A3:G60;"select C where A=717")&QUERY('1'!A3:G60;"select D where A=717"))

Resources