I have two criterias in excel.
I was counting anything that is 2014 and grade k-8 using countifs: =COUNTIFS(A2:C3,"2014",D2:E3,"Grades K-8") but it seems to fail.
Year 1 Year 2 Year 3 Grades K-8 Grades 9-12 Teachers
2014 2015 Grade K-8 Grade 9-12 Teachers
2016 2017 2018 Grade K-8 Grade 9-12 Teachers
I keep getting value error. Any help is much appreciated!
This should do the trick :)
In cell H3, which search for the criteria Grade 9-12 and 2014
=SUMPRODUCT((E2:E6="Grade 9-12")*(A2:C6=2014))
The SUMPRODUCT looks for all combinations given the two ranges and gives you how many times they occur.
Since you search row wise for one criteria and column wise for another you can't use countifs. Or more precisely, your are looking in a range that across both multiple rows and columns when you search for year. So you want countif to compare each item in that array against the item of another array.
Based on the layout of your data and that you are only looking in 1 column for the grade, and the years you are looking for is limited to only 3 columns you can use the following formula:
=COUNTIFS(A:A,2018,D:D,"Grade K-8")+COUNTIFS(B:B,2018,D:D,"Grade K-8")+COUNTIFS(C:C,2018,D:D,"Grade K-8")
Basically the check inside the COUNTIFS, the multiple criteria are all AND checks. SInce the mutiple columns for each year column is an OR, you need to check each year column individually. You can use + like an OR operations and repeat the columns checks.
If you need to check multiple columns and combinations of columns the formula will get unruly and you are better off with an array type formula like Wizhi has for an answer.
Related
I'm trying to get a unique count of data in Column B that fall into the month of June (Column A date field)
Screenshot of Spreadsheet
I highlighted the rows that fall within June in Orange and the duplicate data in red to make it easier to view.
Count Total formula is a simple:
=COUNTA(A:A)-1
Unique Data formula is:
=SUMPRODUCT(1/COUNTIF(B2:B21,B2:B21))
Count June formula is:
=COUNTIFS(A:A,">=01/06/2020",A:A,"<30/6/2020")
But I can't figure out how get a count of unique data that falls within June (expected result is 13)
I've tried filter/unique formulas based on
Excel - Count unique values that meets multiple criteria
But I just can't get it to work. I know I could do it with VBA but this is part of a larger spreadsheet and every other part of the spreadsheet I've been able to do with Formulas, so would like to be able to do this last part with formulas too.
Anyone can help will be a life saver, it's been driving me nuts for the last couple hours.
In Excel 2016, which does not have the UNIQUE or FILTER functions, you can use this somewhat convoluted formula for a Unique count of June entries:
=SUM(IF(FREQUENCY(IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""),IF(LEN(IF(MONTH(Table1[Date])=6,Table1[Data],""))>0,MATCH(IF(MONTH(Table1[Date])=6,Table1[Data],""),IF(MONTH(Table1[Date])=6,Table1[Data],""),0),""))>0,1))
This part of the formula: IF(MONTH(Table1[Date])=6,Table1[Data],"") returns an array consisting of all of the June Data entries.
The LEN(... eliminates the resultant blanks
The Frequency function will then have us wind up with a count of 1 for each entry.
Then we just add it up.
Note that I used a Table and structured references, but you can convert it to regular addressing if you need to.
Of course, if you had Excel O365, you could use the simpler:
=COUNTA(UNIQUE(FILTER(Table1[Data],MONTH(Table1[Date])=6)))
I have this formula:
=SUMPRODUCT((COUNTIF(A2:A1048576,ROW(INDIRECT(DATE(2019,1,1)&":"&DATE(2019,1,31))))>0)+0)
which will add up the unique occurrences between two dates. But I want to add a second criteria for a different column, lets say column "C" and it must contain lets say "TEST" in the cell. How would I modify this formula? I believe it uses COUNTIFS, but I can't seem to get the formula to work? Any help would be greatly appreciated! Thank you!
Date Quantity Notes
1/11/2019 2 OTHER Member Number Corrections
1/14/2019 7 TEST Member Number Corrections
1/14/2019 222 TEST Member Merges
1/15/2019 5 TEST Member Number Corrections
So the answer should be 2, they are both in January, 1/1/2019 - 1/31/2019 and they occurred on only two days, and the formula disregarded that there are blank cells at the bottom.
I am trying to create a SUMIFS function that is adding totals based on several parameters. The final parameter is to use a date in a column and then look for any dates 7 days prior and 7 days after.
I have a list of invoices I am trying to sum up based on travel...conceivably people who are traveling will travel in a short duration. I cant add all invoices up because someone might travel at the beginning of the month and at the end, creating 2 trips.
Lets say the date is in Column I and my criteria cell is I10, I tried to enter the Criteria Range as "(I10-7)=>I10<=(I10+7)"
But this is clearly wrong. Any help is appreciated!
Try,
=sumifs(A:A, I:I, ">="&I10-7, I:I, "<="&I10+7)
Add your other criteria pairs making sure that the criteria ranges are the same number of rows as the sum range.
Hi look at some topics here could not find one that meets what I need to do.
I have a SharePoint list which I open in Excel(2010) in SharePoint I have created a calculated field that counts how days have passed between to dates. in excel these columns are "M" and "N". My calculated column in excel is "T"
This made the calculation in excel simple.
which calculate how many days have passed that is less than 6 (days).
=COUNTIF(Data!$T:$T,"<"& 6)
This give me overall calculation for 12 months. What I need to do is break it down per months.
for example: how many days pass that is less than 6 in Nov. my date column "M" so I tried
=COUNTIF(Data!$T:$T,"<"&6&"AND"& TEXT(Data!$M:$M,"mmm") = "Nov")
This give me a count of zero which I know is not correct. so I was wondering what the best way to add the second columns criteria ?
Try this
=SUMPRODUCT((TEXT(Data!$M:$M,"mmm")="Nov")*(Data!$T:$T<6))
As you have Excel 2010, you can use the more powerful COUNTIFS
=COUNTIFS(Data!$T:$T,"<6",Data!$M:$M,">="&DATE(2013,11,1),Data!$M:$M,"<"&DATE(2013,12,1))
The DATE calculation can also reference cells, so you could change the count to this: (split into lines for readability)
=COUNTIFS(Data!$T:$T,"<6",
Data!$M:$M,">="&DATE(2013,MonthCell,1),
Data!$M:$M,"<"&DATE(2013,MonthCell+1,1))
Say I have an Excel spreadsheet containing student details and dates of courses the student attended. Lets say the row headers are:
Name - Student Grade - Date of course A - Date of course B - Date of course C etc...
Then obviously a separate row per student containing their grade and dates of the courses the student was present in. I want to avoid making modifications to the sheet as the format has been established for a while.
I'm looking for some way of counting all the students with a grade a specific grade, which attended courses between specific dates. For example, count all students with a "C" grade, which attended courses between 1st Jan 2012 to 31st March 2012.
I guess the final formula will be some sort of combination of COUNTIFS and MAX on the date range columns, but I can't see how I can apply this on a row-by-row basis.
All suggestions much appreciated!
Best regards,
Chris
Assuming you have grades in B2:B100 and dates in 5 columns C2:G100 then you can use this formula to count the number of students with a specific grade who took courses in a specific date period.
=SUMPRODUCT((MMULT((C$2:G$100>=J2)*(C$2:G$100<=K2)*(B$2:B$100=I2),{1;1;1;1;1})>0)+0)
where J2 and K2 are the start and end dates of the period (1-Jan-2012 and 1-Mar-2012) and I2 is a specific grade (C)
the {1;1;1;1;1} part depends on the number of date columns, so if there are 7 date columns then you need to change that to {1;1;1;1;1;1;1}.....or you make the formula dynamically adjust by using this version
=SUM((MMULT((C$2:G$100>=J2)*(C$2:G$100<=K2)*(B$2:B$100=I2),TRANSPOSE(COLUMN(C2:G100))^0)>0)+0)
The latter formula, though, is an "array formula" which you need to confirm with CTRL+SHIFT+ENTER
Update
For the number of distinct grades within a specific date range then assuming you have a finite list of possible grades then list those somewhere on the worksheet, e.g. M2:M10 and then you can use this "array formula"
=SUM(1-ISNA(MATCH(M$2:M$10,IF(MMULT((C$2:G$100>=J2)*(C$2:G$100<=K2),{1;1;1;1;1}),B$2:B$100),0)))
confirmed with CTRL+SHIFT+ENTER