Is there a way to count the number of results provided in a VLOOKUP function? For example:
If I wanted to count the results for "Cat" above, it should return 2 because only 2 of the entries for Cat have values in column B. I have tried SUMPRODUCT and COUNTIF but neither gave me the results I needed. Any assistance would be appreciated, thank you!
Or use COUNTIFS:
=COUNTIFS(A:A,C1,B:B,"<>")
try:
=COUNTA(IFNA(FILTER(A:A; A:A="cat"; B:B<>"")))
Related
I have this formula that checks for the 2nd(onwards) instance of duplicate using 2 columns. I want it to be automatically applied to new rows but can't seem to figure out how to use ARRAYFORMULA for COUNTIFS. Can anybody please help me convert this formula =COUNTIFS($K$2:$K2, $K2, $T$2:$T2, $T2)>1 to an arrayformula or something similar? Thanks!
MAP() function may be a good solution. Try-
=MAP($K$2:INDEX($K$2:$K,COUNTA($K$2:$K)),$T$2:INDEX($T$2:$T,COUNTA($K$2:$K)),LAMBDA(x,y,COUNTIFS($K$2:$K,x,$T$2:$T,y)>1))
K2:INDEX(K2:K,COUNTA(K2:K)) will return a array of range from K2 to next non empty cell of K column.
Same T2:INDEX(T2:T,COUNTA(K2:K)) will return a array of range from T column still base on K column last non empty cell.
Edit: As per comment, try below formula-
=INDEX(MAP(A2:INDEX(A2:A,COUNTA(A2:A)),C2:INDEX(C2:C,COUNTA(A2:A)),LAMBDA(x,y,COUNTIFS(A2:A,x,C2:C,y,ROW(A2:A),"<="&ROW(x))>1)))
Change ranges for your sheet.
Hi everyone,
I want to get all the rows where A=1, A=2. The query is very simple but I'm not sure why there is no output. I guess is the problem of the format for column A but I'm not sure what should I change in my formula so that the formula can work. Appreciate any help or advice!
A can't be both: 2 and 1. Instead try
=query(A3:C, "Where A = 2 or A = 1", 0)
It should have been OR not AND - it's impossible for any row in a particular column to have two values simultaneously:
=query(A3:C,"select * where A=1 or A=2",0)
QUERY() is good choice. You can also use FILTER() function like-
=FILTER(A3:C,A3:A>=1,A3:A<=2)
I am quite confused on how this function...
I am trying to count date and activity but inorder to count activity, it should be not blank and it follows the corresponding date. How can I code it? Tried countifs but I can't make it work.
Thanks in advance
https://docs.google.com/spreadsheets/d/1XfAp1RKp55jDRj7jSTIPGQSvy1GHH8KE-VR-vJmCF3w/edit?usp=drivesdk
your formula should be:
=COUNTIFS(A$2:A, D2, B$2:B, "<>")
I need something that auto-fills for however many rows are in the spreadsheet, but I'm not sure if an array is the best way.
In my example below, I want Column C to show a 1 if the corresponding entry in Column A is unique, and a 0 if it isn't.
I had hoped it would be as easy as using ARRAYFORMULA(IF(UNIQUE(A1:A),1,0)), but forgot that IF wouldn't work with the text.
Here's my example with the most recent formula I tried.
Thank you!
Please use the following formula:
=ArrayFormula(IF(LEN(A1:A)<>0,
IF(COUNTIF(A1:A,A1:A)>1,0,1)
,""))
Functions used:
COUNTIF
ArrayFormula
LEN
You can combine ARRAYFORMULA and IF with IFERROR and COUNTIF
Sample:
=ARRAYFORMULA(IF(IFERROR(COUNTIF(A1:A,A1:A)=1,0)=TRUE,1,0))
I have an interval of data that seems like this:
I need to count how many Vs and how many Ds there are.
I already tryed with SUMIF and COUNTIF
Can someone help me?
Solution:
Join all the cells
Use Regex to replace everything other than the required character(ex.V) to null
Find the length of remaining string
Sample Formula:
=LEN(ARRAYFORMULA(REGEXREPLACE(JOIN(,A2:A9),"[^V]",)))
This Formula could also help. Just edit the range and letter according to the requirement here and you will get the exact number.
=ARRAYFORMULA(SUM(len(A$1:A)-len(SUBSTITUTE(A$1:A,"V",""))