Formula to count Text and dates by multiple criteria - excel

I have been trying to create a formula that will count the number of occurrences based on multiple criteria. In the display below I am looking to populate cell C5 with the number of rows that meet a given criteria. In this case, when the start date is between C1 and C2 and the team is Green or Blue or the Department is WAZ. I have been able to get counts to work based on just the date or just the team but have been unable to find a solution with all 3.
Countifs is what I have been trying but without success. I can only get a portion of the criteria to work. As soon as I add in the date part it errors out.
Start 12/21/14 12/28/14 1/4/15
end 12/27/14 1/3/15 1/10/15
Project ID start date end date team Department
1 1/7/15 6/26/15 Blue SRT
2 12/27/14 1/23/18 Green DFT
3 1/8/15 3/20/15 Red DFT
4 1/3/15 6/20/15 Red WAZ
5 12/29/14 7/12/15 Blue DFT

Supposing that you have the following criteria:
J5 = red
J6 = DFT
and your are looking for dates (start & end) in C1 and C2.
I am using my example, please follow the data in the image below:
so put this formula in cell C3, which shows the number of rows for your query:
=COUNTIFS($C$5:$C$11,">="&C1,$D$5:$D$11,"<="&C2,E5:E11,J5,F5:F11,J6)
as you see the formula yields 2 because there are only two rows that match these conditions. (the rows are in bold, rows 6 and 7).
So basically a countifs can contain several criteria:
COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, criteria_range3, criteria3 ...)

Related

How to count conditional formatted cell colors across a row

I have 5 cells that are conditional formatted. Column B is CF for 48 months and turns red on 48 months and 1 day, Column C is for 36 months, Column D is for 24 months, Column E is for 18 months, and Column F is for 12 months.
I would like to be able to use a count color formula to count the green color cells across the row (i.e., B1:F1) and place the result in H1. I have tried to use every VBA I could find but none of them work. For Example, when I use a COUNTConditionColorCells Function, it produces different number sequences next to the cell range box (see attachment) Thanks
Sample Worksheet
Function Argument

Excel column autofill (autoincrement with formula)

500 employees will have 3 hours of work each day (for sample made weekday image sample). so i tried with auto increment for B2 cell "=sum(A2+3)".
problem arise when i try to enter Absent data or the cell is cleared the data starts from 3 like in E4 or like in E5. need to Enter AA for absent data for that day.
So base the calculation on col A only and multiply the 3 by the column number less 1:
=$A2+(3*(col()-1))
as the column position will multiply by 1, 2 or 3 etc similar to the progression you expected from your method.

Vlookup and sum all instances of the matching lookup

this is probably an extremely basic problem but I can't figure a way to do this within Excel.
I have a list of values IDs from a regional sales manager,
he wants to see if his figures have been inputted into the monthly report and are reporting correctly.
However, as he sells by region and we report by product we have multiple instances of his ID by Product
so our monthly report.. for example
ID Value
1 16,999
1 22,521
3 400
3 221
5 71
6 22,000
So he has provided me with a list of IDs
1
2
3
4
5
6
and wants a list with its total revenue not just the first match up.
Is an excel limitation or is there a way to do this?
You can use a SUMIF formula. Basically you give it the column to check the value of, then you give it the expected value and finally the colum to sum.
Option 1 (whole range)
=SUMIF(A:A, 1, B:B)
Option 2 (defined range)
=SUMIF(A1:A7, 1, B1:B7)
Option 3 (Using excel table)
=SUMIF([Id], 1, [Value])
For more details please refer to: https://support.office.com/en-ie/article/sumif-function-169b8c99-c05c-4483-a712-1697a653039b
Is this what you're looking for?
=SUMPRODUCT((A1:A5=1)*B1:B5)
Taken from here: Sum values from multiple rows using vlookup or index/match functions
How it works:
An array formula is used to create an array of numbers that gets passed to the SUMPRODUCT formula.
The array formula processes A1 and B1 together, then A2 and B2 and so on... if A1 is equal to 1, B1 is added to the array.

Excel (Google Spreadsheet): get values between two dates

I have seen lots of questions regarding this, on here and on other websites. However even with all that I have read I cannot accomplish what I want.
I have an Excel document with in cell A2 a starting date and in B2 an end date.
In A5:C11 I have a table with data. In cells A5:A11 I have dates, in B5:C11 I have the data. Now I want to display the data from B and C if they fall between the dates given in cells A2 and B2. I want to do so via a formula. I have tried many formulas with index, match, vlookup, small , sumproduct, if(s) and so on. Maybe any of you can help me?
Start date End date
29-12-2017 29-12-2017
Date Users Pageviews
04-01-2018 350 400
03-01-2018 300 350
02-01-2018 250 300
01-01-2018 200 250
31-12-2017 150 200
30-12-2017 100 150
29-12-2017 50 100
In this case I want the output to be, preferably in 3 cells:
29-12-2017 50 100
Make another table in F5:G11 with this formula in F5 and copy over:
=IF(AND($A5>=$A$2,$A5<=$B$2),B5,"")
Then in H5:I11 use this formula to remove the blank rows (adapted from here):
=IFERROR(INDEX(F$5:F$11,AGGREGATE(15,6,(ROW(F$5:F$11)-ROW(F$5)+1)/(F$5:F$11<>""),ROWS(G$5:G5))),"")
The result:
Parameter to change in green, your data in blue, intermediate formulae in grey (hide these columns?) and the final result in orange.
To get the list of dates use:
=IFERROR(AGGREGATE(15,6,$A$5:$A$11/(($A$5:$A$11>=$A$2)*($A$5:$A$11<=$B$2)),ROW(1:1)),"")
Then once we have the dates it is a simple Vlookup for the other two:
=IF(F5<>"",VLOOKUP($F5,$A$4:$C$11,COLUMN(B:B),FALSE),"")
Put the First in F5 and copy down.
Put the Second in G5 and copy over one column and down.

Calculate results and then count them based on a criteria in one formula

I have the following Excel spreadsheet:
A B C D E
1 Sales 500 200 400 300
2 Difference (Helper Row) -60% 100% -25%
3
4 Criteria: -20%
5 Result: 2
Formulas:
C2 = C1/B1-1
D2 = D1/C1-1
E2 = E1/D1-1
B5 = COUNTIF(B2:E2,"<"&-0.2)
In Row 1 you can see the sales over the last 4 periods. In Row 2 the difference between the sales is calculated using the simple formulas described above.
In Cell B5 I want to show the number of differences (Row 2) which are below the criteria in Cell B4. In this case the result is 2 because -60% and -25% are below the criteria of -20%.
All this works perfectly so far. However, I would prefer to have this system without the Helper Row 2 that I currently use to calculate the differences between the sales in Row 1.
Do you know a formula that gives me the exact same result but calculates the differences automatically and then counts them if they meet a certain criteria?
Try the following
=SUMPRODUCT(--(C1:E1/B1:D1-1 <B4))
If dealing with potential 0s in Sales
={SUM(--(IFERROR(C1:E1/B1:D1-1,0)<B4)*--(C1:E1>0))}

Resources