Match and count in a vacation tracking sheet - google-sheets

My team has a vacation tracking calendar in Google Sheets. I'm trying to create a formula (for the red cells) to automatically count the number of days entered in the calendar by person and absence code.
I've tried a number of different ways to solve this using Countifs, Match and Index but it only works for a single range, yet I need to count one range for each month of the year.
Is there an easier way to do this than adding 12 similar formulas together.

Assuming you don't need a spill range you could just do a basic countif off of a filtered range on the name.
so if your data starts on A8 and goes all the way to column f (you'd want more), and you put the exact string you're searching above the cell in row 3, this should work:
=countif(filter($A$8:$F,$A$8:$A=$C3),D$2)
Here's a sample sheet from screen shot.

Related

How can I count the number of items listed on a different google sheet based on dates in 2 different cells and if another cell is blank?

I have a google doc that tracks information about employee training (Example 1). I have another google doc that needs to summarize the information (Example 2) from multiple different sheets which mirror example 1 but for different teams.
Example 1: this sheet is tracking employees start dates, dates they finish training, and if they have quit. (there are multiple different docs all with the same format that I'm pulling from using importrange).
I need a formula that will count the number of employees currently in training. So count if start date is equal to or after today, end date is equal to or less than today, and the quit column is blank.
If the formula worked the way it should, and I was looking at the summary doc on 11/10/2021, it should report 4 people in the "# in Training" column on the table below (Example 2).
I have tried using an ArrayFormula with CountIfs to accomplish this, but it still pulls 0. Here is the formula I've been playing with:
=ArrayFormula(COUNTIFS('tracker'!$B$2:$B, "<="&TODAY(), 'tracker'!$C$2:$C, ">="&TODAY(), 'tracker'!$D$2:$D,""))
Give a try on below formula-
=COUNTIFS(B2:B8,"<=" & DATE(2021,11,10),C2:C8,">=" & DATE(2021,11,10),D2:D8,"")

COUNTIF with IMPORTRANGE with date range and unique ID criteria

I haven't been able to find a solution to get this formula to work after multiple days of searching. The google spreadsheet we use is large and used by many people so I would like to keep this in a separate google sheet using IMPORTRANGE.
Data Needed:
Count of assignments a specific user completed within 7 days and after 7 days based on a start and end date.
Where I'm running into issues:
I simplified the equation by using a small data set in the same sheet to see the main issue. When giving a range for the user # the formula doesn't work anymore. When only comparing it to one user # at a time it does.
For example:
This doesn't work:
=COUNTIFS(C2:C-B2:B,"<7",A2:A,E2)
This one does but needs to have the range for the table to work:
=COUNTIFS(C2:C-B2:B,"<7",A2,E2)
I might be going about this all wrong. Any help I could get is much appreciated.
E2: =UNIQUE(FILTER(A2:A, A2:A<>""))
F2 and drag down: =COUNTIF(ARRAYFORMULA(DAYS(FILTER(C$2:C,$A$2:$A=$E2),FILTER(B$2:B,$A$2:$A=$E2))),"<=7")
G2 and drag down: =COUNTIF(ARRAYFORMULA(DAYS(FILTER(C$2:C,$A$2:$A=$E2),FILTER(B$2:B,$A$2:$A=$E2))),">7")

Automatically increment a COUNTIF date criterion

https://docs.google.com/spreadsheets/d/1EUgEwLmiNv9ug66DWzXjnuZ2GzavSbNqs-UTysiwZbM/edit?usp=sharing
I have this Google Sheets with multiple tabs that record projects published on a date.
One of the tabs (Stats) records the total number of projects published by everyone on a particular day. I am using COUNTIF in the last tab to record productivity. I don't want the range to change when I drag the formula: I want the criterion to add a date automatically so as to get the result for the next day. I am having to re-write the formula.
Bob on the left, Randy on the right:
Output (Stats):
In Stats!C2 and copied across and down to suit:
=countifs(indirect(C$1&"!A:A"),"="&$A2,indirect(C$1&"!C:C"),"Done")
should be sufficient, provided you make the column labels in Stats match the sheet names (even for spaces).

Compare data google sheets

I am using google sheets and I want to compare the quantity of interactions o a given person in a period of time.
My problem is that between one week and another, the people can change, some people can have no interactions and is not reported and I can have new people.
So I need a formula that allow me to compare the previous period of time but also the name.
I am trying this in order to follow up how the people's behavior is changing.
This is the example spreadsheet.
Thanks
This is an easy, quick-and-dirty solution using vlookup.
There are two variations. One using a single criteria and one using multiple criteria. infoinspired.com has a good article on How to Use VLOOKUP with Multiple Criteria in Google Sheets.
Single Criteria: This is the formula.
=iferror(vlookup((B2+1)&C2,$A$2:$D$9,4,false),"error")
This involves a cheat by creating a new column A which contains the concatenation of the date and name values for each row. This is a unique value.
The lookup criteria is the (date (B2) plus 1=the next day) and the name.
The lookup range is self-explanatory and the value returned is the Quantity (from column 4).
The vlookup formula is inside an iferror() so that any problems are highlighted.
Multiple Criteria: This uses an array formula.
=ArrayFormula(iferror(vlookup((B2+1)&C2, {B2:B&C2:C, D2:D}, 2, 0 ), "error"))
The vlookup component is very similar to the "simple" formula. The difference is that each criteria 1:(Date plus 1) and 2:Name are recognised separately, and assigned discrete lookup columns (B and C respectively).
Again, the whole thing is wrapped in an iferror statement to highlight any problems.
This spreadsheet shows the workings:

SUMIFS function across multiple sheets

For reference, please visit this Google Doc which is a simplified example of my problem, which is to determine total sales in Blue and Green markets each month.
Each month, I receive a new sales report from accounting for all of our markets and I add the sheet to the main workbook. My team is in charge of assigning "colors" to the markets and tracking this. As it's privileged information, we can't have accounting auto-tag these in the data they send over.
One solution would be, for each new monthly report that comes in, tag each city with the color. However, we have hundreds of markets and this isn't very practical to go through each time.
I assume that a SUMIFS function would work here, but am unsure how to set it up when there are values spread across multiple sheets.
You can use this function in B8 of February tab:
=SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0))
COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0 gets an array of the countries that belong to the colour specified in A8 of the current tab (Would that be possible to put only Green and remove February Sales from that cell?).
If the country belongs to the particular colour, then return the array of corresponding values in column $B$2:$B$5.
Lastly, sum this array.
Note:
You need to array enter this formula in Excel (by holding Ctrl+Shift then hit Enter after typing in the formula).
In Google Spreadsheets, you array enter a formula by wrapping the formula around =ArrayFormula(), meaning you use:
=ArrayFormula(SUM(IF(COUNTIFS($A$2:$A$5,Color!$A$2:$A$5,Color!$B$2:$B$5,'Sales February'!A8)>0,$B$2:$B$5,0)))
In Excel you can use this "array formula"
=SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5))
confirmed with CTRL+SHIFT+ENTER
The same formula works in google docs if wrapped in arrayformula, i.e.
=arrayformula(SUM(SUMIF(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),B$2:B$5)))
or you can use FILTER as user3465711 suggests, i.e.
=SUM(filter(B$2:B$5,isnumber(match(A$2:A$5,IF(Color!B$2:B$5=A8,Color!A$2:A$5),0))))

Resources