Excel Formula COUNTIFS and counting non-blank cells - excel

I know this has been answered before, but I have tried the formulas suggested.
I am trying to count rows only if the first column has specific text (at least partial text) and the second column is NOT blank.
Here is my formula:
=SUM(SUMIF(A2:A33,"BA*",B2:B33)/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"))*2))
My problem is that the rows where Column B is blank are still getting counted.
I have tried:
=SUM(SUMIF(A2:A33,"BA*",B2:B33)/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"&""))*2))
Same results.
Evaluation shows:
=SUM(8/SUM((COUNTIFS(A2:A33,"BA*",B2:B33,"<>"&""))*2))
THEN:
=SUM(8/SUM((7)*2))
THEN:
=SUM(8/14)
Any ideas what I am doing wrong here?

Use
=COUNTIFS(A2:A33,"BA*",B2:B33,"<>")

Related

how to find largest letter (A-Z) in a range which also contain some blank cells in Excel

In my excel sheet, I wanted to find the largest letter in a range raw-wise. Some cells in the range are blank cells. I tried the below formula but it didn't work for me. Please help me to solve this out
=CHAR(AGGREGATE(15,6,CODE(A1:A10),1))
Thanks!
Try using anyone of the either
=CHAR(AGGREGATE(14,6,CODE(B3:L3),1))
AGGREGATE doesn't work in google sheets
Try ARRAY FORMULA With LARGE Function
=ARRAYFORMULA(CHAR(LARGE(IFERROR(CODE(A2:K2);"");1)))
Try
=index(sort(transpose(split(regexreplace((TEXTJOIN("",,A2:K2)),"(.)","|$1"),"|")),1,0),1)
You can try:
Formula in M3:
=INDEX(QUERY(SPLIT(FLATTEN(ROW(B3:K)&"|"&B3:K),"|"),"Select Max(Col2) group by Col1 label Max(Col2) ''"))
A single array formula that will spill results down. Also, it would now no longer matter if the largest value is also the latest. Put an 'X' down under 'EI-1` in the 1st row and it will be your latest version.
See a sample spreadsheet

Extracting distinct values from a table in excel but a zero kept showing in between my results?

I'm trying to extract unique values from a list with empty cells in between in Excel. Currently, the formula I'm using is:
=IFERROR(INDEX('Raw List'!$D$5:$D$999,MATCH(0,COUNTIF($B$7:B7,'Raw List'!$D$5:$D$999),0)),"")
The 1st picture indicates the table (D5:D999) and the second picture is the target output. As you can see, the results is correct and it ignores duplicate values but then there's a "0" that keeps popping up and I'm not sure how to fix this.
Does anyone know what might cause this and how to fix the formula?
Thank you!
If you have Excel O365, with all the current functions, you can use the simpler formula:
=UNIQUE(FILTER(theRange,theRange<>""))
Note that you still have to filter out the blanks.
When the Countifs processes the range D5:D999 and gets as far as the first blank cell, it will return a count of zero, so you will get a match. Unfortunately, when Index refers to this blank cell it returns it as a zero, so that's where the zero comes from. You can fix it by checking that the current cell is non-blank as below. When the countifs runs out of non-blank non-duplicate cells, it will trigger the Iferror and return an empty string as expected.
=IFERROR(INDEX('Raw List'!$D$5:$D$999,MATCH(1,(COUNTIF($B$7:B7,'Raw List'!$D$5:$D$999)=0)*('Raw List'!$D$5:$D$999<>""),0)),"")

Index Match formula issue with multiple criteria

I have an issue with Index/match formula in Excel.
I have the following formula;
INDEX('[Master 2019-20.xlsx]SM'!$G$2:$G$5000,MATCH(1,('[Master 2019-20.xlsx]SM'!$M$2:$M$5000=$C2)*('[Master 2019-20.xlsx]SM'!C$2:$C$5000=$B2)*('[Master 2019-20.xlsx]SM'!$AE$2:$AE$5000=$A2),0))
Detail around the formula..
Index is column 'G' which is a list of reference numbers.
first match is from column 'M' which is a product description.
second match is from column 'C' which is the week number.
third match is a count column 'AE' which is looking for '1'.
This returns the value I require for that week if there is only one entry for that given week. the problem comes if there is more than one entry for that week? how can I show all reference's within a single week that meets the above criteria?
is there a way of populating a list that if the above criteria is met then it will show all associated references from column 'G'.
Any help with this would be appreciated. any other formula suggestions also welcome.
Thanks in advance.
Hereby a small example:
Formula in F2:
=IFERROR(INDEX(A$1:A$11,SMALL(IF((B$2:B$11="A")*(C$2:C$11<10),ROW(A$2:A$11)),ROW(1:1))),"")
So here I looked for values with the following criteria:
Value = A under header2
Value is less than 10 under header 3
Note1: It's an array formula and need to be confirmed through CtrlShiftEnter
Note2: If I made no copy paste errors, that would mean you need to use: =IFERROR(INDEX('[Master 2019-20.xlsx]SM'!G$1:G$5000,SMALL(IF(('[Master 2019-20.xlsx]SM'!$M$2:$M$5000=C$2)*('[Master 2019-20.xlsx]SM'!C$2:$C$5000=B$2)*('[Master 2019-20.xlsx]SM'!AE$2:AE$5000=A$2),ROW('[Master 2019-20.xlsx]SM'!G$2:G$5000)),ROW(1:1))),"")

using a cell from another sheet as reference

I wrote a formula which calculates the inputs in "Sheet2" which is below. So J4 is a cell of Sheet2:
=((COUNTIF((INDIRECT(ADDRESS(ROW(J4);COLUMN(J4))&":J"&
(MIN(IF(A4:A107="";ROW(A4:A107))))));"
<>"&""))-1)/((COUNTIF((INDIRECT(ADDRESS(ROW(J4);COLUMN(J4))&":J"&
(MIN(IF(A4:A107="";ROW(A4:A107))))));"<>0"))-1)
Now I want to write this formula to a cell in Sheet1.It means i should reference the Sheet2 for calculating the formula.
Can anyone help me with referencing?
EDIT: I still am without solution for this issue. Can anyone suggest me something new then in the comments?
Looking at your formula, it seems you want to evaluate ratio of:
Count non-blank cells in column J where column A is also non-blank.
Divide this count by count of non-zero cells in column J where column A is non-blank.
If yes then test following formula and see if it works per your needs:
=COUNTIFS(Sheet2!A4:A107,"<>",Sheet2!J4:J107,"<>")/COUNTIFS(Sheet2!A4:A107,"<>",Sheet2!J4:J107,"<>0")
Make sure you change argument separators.
Edit
In that case, you need to use following array formula (CTRL+SHIFT+ENTER) and change argument separators.
=COUNTIFS(Sheet2!A4:INDEX(Sheet2!A4:A107,MIN(IF(Sheet2!A4:A107="",ROW(Sheet2!A4:A107)))),"<>",Sheet2!J4:INDEX(Sheet2!J4:J107,MIN(IF(Sheet2!A4:A107="",ROW(Sheet2!A4:A107)))),"<>")/COUNTIFS(Sheet2!A4:INDEX(Sheet2!A4:A107,MIN(IF(Sheet2!A4:A107="",ROW(Sheet2!A4:A107)))),"<>",Sheet2!J4:INDEX(Sheet2!J4:J107,MIN(IF(Sheet2!A4:A107="",ROW(Sheet2!A4:A107)))),"<>0")

How to make count function in excel count this cell only if another column in that row is not blank

I am trying to count a column in Excel but I want it to be counted only if it is not blank and has value in another column.
Here, I want to count the number of cells in Text2 which are not blank and also have value in Text1. In this case the value should be 3
I have tried Count(), Countif() with NOT(ISBLANK()) etc. But nothing seems to work.
Can someone help me out ?
Thanks.
Please try:
=COUNTIFS(B2:B11,"<>",C2:C11,"<>")
This trick works with Excel and relational databases. Add a new column and set the value to 1 if your complex conditions are met. Set the value to 0 if they are not met. Then sum that new column and you will have your answer.
Sorry but I don't have a copy of Excel handy, but I think that E2 would have the formula
=IF(AND(IF(C2<>"",TRUE,FALSE),IF(B2<>"",TRUE,FALSE)),1,0)
You may have to adjust the formula, but the trick is universal.

Resources