Google Sheets: ArrayFormula with CountBlank - google-sheets

I am trying to wrap the following formula in an array formula:
=IF(A3=0,,COUNTBLANK(E3:3))
I tried doing this:
=ARRAYFORMULA(IF(A3:A=0,,COUNTBLANK(E3:E:3)))
but get a formula error.
What is the correct way to do it?

you will need to do it like this:
=ARRAYFORMULA(IF((LEN(A3:A))*(A3:A<>0), COLUMNS(E3:3)-
MMULT(IFERROR(LEN(INDIRECT("E3:"&ADDRESS(ROWS(A1:A),
COLUMNS(A1:1),4)))/LEN(INDIRECT("E3:"&ADDRESS(ROWS(A1:A),
COLUMNS(A1:1),4))), 0), TRANSPOSE(COLUMN(E3:3)^0)), ))

Related

Extract Substrings using importxml in google sheets

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.

Adapt a formula to ArrayFormula

Im very new to Google Sheets formulas.
Im trying to convert this formula:
=INDEX(PRX_ARM,MATCH(ELECTRICITE!E97,OFFSET(PRX_ARM_C1,0,MATCH(ELECTRICITE!G97,PRX_ARM_L1
,1)-1),1), MATCH(ELECTRICITE!G97&"1",PRX_ARM_L1,1))+
ELECTRICITE!H97*INDEX(PRX_REL,2,2)+
ELECTRICITE!I97*INDEX(PRX_REL,3,2)+
ELECTRICITE!J97*INDEX(PRX_BP_VOY,2,2)+
ELECTRICITE!K97*INDEX(PRX_BP_VOY,3,2)+
ELECTRICITE!L97*INDEX(PRX_BP_VOY,4,2)+
ELECTRICITE!M97*INDEX(PRX_BP_VOY,5,2)
So naturally, i converted every single cell reference to the range ArrayFormula must be applied to :
=ArrayFormula(INDEX(PRX_ARM,MATCH(ELECTRICITE!E90:E5030,OFFSET(PRX_ARM_C1,0,MATCH(ELECTRICITE!G90:G5030,PRX_ARM_L1,1)-1),1),
MATCH(ELECTRICITE!G90&"1",PRX_ARM_L1,1))+
ELECTRICITE!H90:H5030*INDEX(PRX_REL,2,2)+
ELECTRICITE!I90:I5030*INDEX(PRX_REL,3,2)+
ELECTRICITE!J90:J5030*INDEX(PRX_BP_VOY,2,2)+
ELECTRICITE!K90:K5030*INDEX(PRX_BP_VOY,3,2)+
ELECTRICITE!L90:L5030*INDEX(PRX_BP_VOY,4,2)+
ELECTRICITE!M90:M5030*INDEX(PRX_BP_VOY,5,2))
But it does not work.
Do you know what im doing wrong?
Thanks in advance.
Yu can't use index with arrayformula, use instead vlookup

Arrayformula inside an array in google sheets

I have the following formula in google sheets which works perfectly in the row 3.
=ArrayFormula(if(len($A$3:$A),vlookup($A$3:$A,'All records in progress'!A2:BE,{57,6,7,8,9,10,11,13,14,31,32,33},FALSE),""))
However, I would like to have the formula in the row 2 with the header so I was trying to create something like this:
={"Header"; ArrayFormula(if(len($A$3:$A),vlookup($A$3:$A,'All records in progress'!A2:BE,{57,6,7,8,9,10,11,13,14,31,32,33},FALSE),""))}
So I could have the word Header in the first row and the formula from the next row onwards. However, my formula is not working. Do you know if how I could achieve this?
Looking forward to your reply.
Cheers,
your vlookup returns 12 columns so you need:
={{"Header","","","","","","","","","","",""};
ARRAYFORMULA(IF(LEN(A3:A),
IFNA(VLOOKUP(A3:A, 'All records in progress'!A2:BE,
{57,6,7,8,9,10,11,13,14,31,32,33}, 0)), ))}

How can I search a column with alphanumeric entries and return a 1 for unique with an array formula?

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))

Google Sheets - Arrayformula referencing other sheets equals broken formula

I have a spreadsheet with a few sheets I reference with =INDEX. The code I use below works fine when I Paste as Formula to all the cells in a column.
=INDEX(DATABASE!A:A, MATCH('SMS FINAL'!C2:C, DATABASE!C:C, 1))
The code I am trying to use has ArrayFormula so that I only have to type the formula in once:
=ArrayFormula(
IF(ROW(E:E)=1,"Company",
IF(ISBLANK(E:E),"",
INDEX(DATABASE!B:B,
MATCH('SMS FINAL'!C:C, DATABASE!C:C, 1)
))))
This breaks the column and only leaves the "Company" in the header row. Any ideas?
try it like this:
=ARRAYFORMULA({"Company";
IF(ISBLANK(E:E), ,
INDEX(DATABASE!B:B,
MATCH('SMS FINAL'!C:C, DATABASE!C:C, 0)))})
or like this:
=ARRAYFORMULA({"Company";
IF(ISBLANK(E2:E), ,
INDEX(DATABASE!B:B,
MATCH('SMS FINAL'!C:C, DATABASE!C:C, 0)))})

Resources