Hi is there a way to count elements in array like that (im using google sheets)
I tried googling but didnt find anyone having the same problem
=counta(split(cellref,",")) will count the number of elements in the array (where cellref is location of your array to be split).
try:
=LEN(REGEXREPLACE(A1; "[^,]"; ))+1
for array:
=INDEX(IF(A1:A="";;LEN(REGEXREPLACE(A1:A; "[^,]"; ))+1))
Related
Using IMPORTXML in google sheets. I want to extract part of the result into one cell.
=IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")
I got the result spread over several columns. B8:F8
The inspect element is like this. I only want the value "2". It is in cell B8.
I think this can be done using substring-after. But I could not get the correct result.
In your situation, how about the following samples?
=REGEXREPLACE(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"[^0-9]","")
=REGEXEXTRACT(JOIN("",IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span")),"\((.*)\)")
References:
REGEXREPLACE
REGEXEXTRACT
I use this formula. That works too.
=INDEX( IMPORTXML(B1,"//div[#class='orca-rating SwtJyda color-yellow tbody-6']/span"),3)
But tanaike's formula is very good.
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<>"")))
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'm trying to build an array formula on google sheets for this :
=CONCATENATE(MID(C2,4,3),(MID(C2,1,3)),MID(C2,7,4))
The problem is that when I use array formula going from C2:C, it will concatenate all the rows at the same time, which is not what I want.
Does anybody know how to properly use the array on that case? So it will keep looking for just the value on C2, C3,C4 and so on?
Thank you!
Use the ampersand character instead of CONCATENATE:
=ArrayFormula(IF(C2:C="", "", MID(C2:C,4,3)&(MID(C2:C,1,3))&MID(C2:C,7,4)))
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))