Using COUNTIFS in Excel, check cells (containing formulas) that are empty - excel-formula

Good day.
In it's basic form, I need to count how many cells are empty.
Using the following below, I can count how many cells are empty.
=COUNTIF(Sheet1!C:C,"<>")
However, if the cells in column C contain formulas, it won't work.
After some googling, I found out that using SUMPRODUCT will get what I need
=SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
Now, here's my problem.
I need to use that as a criteria inside a COUNTIFS function, but I don't know how to do that because it's referencing some ranges.
So just to make it simple, using COUNTIF or COUNTIFS function specifically, how can I pass a criteria that checks if cell (with formula) is empty.
This formula returns 0 but most likely I'm just not passing it properly as a criteria.
=COUNTIF(Sheet1!C:C,SUMPRODUCT(--(LEN(Sheet1!C:C)>0)))
Happy for other ways to count cells (with formulas) which are empty, but I need to use it as a criteria for a COUNTIF/COUNTIFS function.
Thank you very much.

If I understand what you're looking for, you were pretty close already.
Following the formula's you already found you can use them like:
=COUNTIF(Sheet1!C:C,"<>")-SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
It will result in the count of cells that have a value/formula minus the count of cells that show a value (blank formula result is excluded).
The result is the count of cells that contain a formula with blank result.

Related

Automatic Excel Formula instead of writing by hand

Im trying to count the duplicated values between the 2 row so im using the formula as you can see it in the image =SUM(COUNTIFS(E4:S4,{"1","2","3"}))
so I have to write the numbers so I dont want write the numbers I want select the cells instead, any formula would do that? I already searched and tried many things but nothing seem to work
Put those values in cells - and refer to those cells as condition.
Next level: insert those values in a table, that you eg. call FilterBy and the column values
Then you can us this formula:
=SUM(COUNTIFS(E4:S4,filterBy[Values]))
Hat I don't understand: why are you using SUM - like this, it doesn't make sense, as COUNTIFS returns one value.
If you want to some all filtered values then you need this formula:
=SUM(SUMIFS(E4:S4,E4:S4,filterBy[Values]))

Excel COUNTIF with multiple criteria and both row and column

I'm trying to make a COUNTIF that checks range E8:AI8 for the letter "D" and the range E7:AI7 for any of the following numbers 2;4;8;9;15;20;26;27;33;34;40;41
Also cells in range E5:AI5 to not equal any cell in C105:C118
E5:AI5 is dates in a calender.
C105:C118 is a list of dates for holidays.
My formular so far is looking like this:
Sumproduct(countifs($E$8:$AI$8;"*D*";$E$7:$AI$7;
{2;4;8;9;15;20;26;27;33;34;40;41};$E$5:$AI$5;"<>"&$C$105:$C$118))
However its not really turning out like i want it, the first two parts of the fomula are working as intended, but the last part comparing the row to the list of dates is not. Is it even possible to compare a row to a column? Or is there another way to do this?
That is not something you can do really inside a COUNTIFS() as described here. Consider to use SUMPRODUCT() with some MATCH() nested inside:
=SUMPRODUCT((E8:AI8="D")*(ISNUMBER(MATCH(E7:AI7,{2,4,8,9,15,20,26,27,33,34,40,41},0)))*(ISNA(MATCH(E5:AI5,C105:C118,0))))

Count cells bigger than 0, IF empty skip cell

I'm having a problem writing my formula that should count all selected cells that contain a number bigger than 0 and skip the cells that are completely empty, even when the cell is selected. Excel gives me an error that I selected cells that not contain a number. How can I skip them?
This is my formula:
=COUNTIFS(C8:C12;E8:E12;G8:G12;I8:I12;K8:K12;">0")
I'm thinking you using the COUNTIFS() formula wrong, after each range, there is a criteria. You can't have multiple ranges like that to look through. For more information look here or here.
In your case you are dealing with a non continues range, and one way to deal with that would be this
So the formula would translate to:
=SUM(COUNTIF(INDIRECT({"C8:C12","E8:E12","G8:G12","I8:I12","K8:K12"}),">0"))
Another formula you could try is:
=INDEX(FREQUENCY((C8:C12,E8:E12,G8:G12,I8:I12,K8:K12),0),2)
And looking at your data, it seems as though the rest of the columns contain text (not sure, they may be dates). In case they are text values:
=SUMPRODUCT((ISNUMBER(C8:K12))*(C8:K12>0))
If they are actually dates (assuming from 2018), then you could try:
=SUMPRODUCT((YEAR(C8:K12)<2018)*(C8:K12>0))
I'm assuming this is what you looking for, instead of a VBA based solution due to the tags provided and your formula.
You could also do it in this particular case by skipping the columns that you don't want:
=SUMPRODUCT((C8:I12>0)*ISEVEN(COLUMN(C8:I12)-COLUMN(C8)))
what will be happen if you use the below formula? to you receive an error?
=COUNTIF(C8:C12,">0")+COUNTIF(E8:E12,">0")+COUNTIF(G8:G12,">0")+COUNTIF(I8:I12,">0")+COUNTIF(K8:K12,">0")
Try this
Requirement cannot be done in single formula,
combining 2 or more formula will help fixing the formula.
formula
=COUNTA(B2:B9,D2:D9) -- Count all the non blank cell's
=COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0") -- Count all the cells will value as 0
Subtract both which will give the output you are looking for
Combined formula
=COUNTA(B2:B9,D2:D9)-(COUNTIF(B2:B9,"=0")+COUNTIF(D2:D9,"=0"))

SUMIF with several OR criteria

The blue cell summates to 1, but that is not correct and it should summate to more because of the row text match with B47 row. Any ideas what's wrong?
SUMIF is not supposed to work with more than one criteria (you can't check multiple criteria within one SUMIF as you tried in your formula).
This formula will calculate the right result for you: =SUM(B3:BI3*(IFERROR(MATCH(B2:BI3,B47:AL47,0)>0,0))), this is an array formula, so you need to press CTRL+SHIFT+ENTER after it.
MATCH(...): look for all students whether they are in the list with requirments (this is the part which works only as array formula)
IFERROR(...): converts #N/A errors to 0
If I am not wrong, you are trying to calculate the number of students for a particular project with skill1 and skill2.
You may also try using COUNTIFS() function. This works for multiple criteria.

Using nesting vlookup formulas for use in automation code

I am trying to write a formula that uses different vlookups depending on whether the formulas produce errors or not. I have 3 tabs, each with 3 columns.the first two columns contain values that are in the vlookup, with the third colum containing the value I want to find. Basically i want a formula that will use different vlookups depending on whether the lookup value is found in teh first tab or the second . Below is the formula i am working with. It works to bring in values from Sheet1 into Sheet3, but doesnt work when the values are in Sheet2. Also will be inserting this formula into vba code for automation use.
=IF(OR(ISERROR(VLOOKUP(B2,Sheet1!B2:C19,2,FALSE)),ISBLANK(VLOOKUP(Sheet3!B2,Sheet1!B1:C19,2,FALSE))),IF(OR(ISERROR(VLOOKUP(Sheet3!A2,Sheet1!A1:C19,3,FALSE)),ISBLANK(VLOOKUP(Sheet3!A2,Sheet1!A1:C19,3,FALSE))),IF(OR(ISERROR(VLOOKUP(Sheet3!B2,Sheet2!B1:C21,2,FALSE)),ISBLANK(VLOOKUP(Sheet3!B2,Sheet2!B1:C21,2,FALSE))),IF(OR((ISERROR(VLOOKUP(Sheet3!A2,Sheet2!A1:C21,3,FALSE))),ISBLANK(VLOOKUP(Sheet3!A2,Sheet2!A1:C21,3,FALSE))),"non",VLOOKUP(Sheet3!A2,Sheet2!A1:C21,3,FALSE)),VLOOKUP(Sheet3!B2,Sheet2!B1:C21,2,FALSE)),VLOOKUP(Sheet3!A2,Sheet1!A1:C19,3,FALSE)),VLOOKUP(Sheet3!B2,Sheet1!B1:C19,2,FALSE))
it returns the value sI am looking for up until the lookup values start occuring in Sheet2. At that point it shows me "non".
Any help would be greatly appreciated! Thanks
Your first VLOOKUP does not reference "Sheet3".
I think The below equation does what you are looking to do (assumes you are on Sheet3).
=IF(IFERROR(VLOOKUP($B$1,Sheet1!A:C,3,FALSE),"")="",IF(IFERROR(VLOOKUP($B$1,Sheet1!B:C,2,FALSE),"")="",IF(IFERROR(VLOOKUP($B$2,Sheet2!B:C,2,FALSE),"")="",IF(IFERROR(VLOOKUP($B$2,Sheet2!A:C,3,FALSE),"")="","nan",VLOOKUP($B$2,Sheet2!A:C,3,FALSE)),VLOOKUP($B$2,Sheet2!B:C,2,FALSE)),VLOOKUP($B$1,Sheet1!B:C,2,FALSE)),VLOOKUP($B$1,Sheet1!A:C,3,FALSE))

Resources