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)))
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.
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
Trying to break apart rows containing numbers like "198,183,158,315,274" by their comma, and then average them out and divide them by a singular number; using arrayformula. It only produces one row of result and it's incorrect though?
Here is my test sheet, editable
Thanks for any help.
try:
=ARRAYFORMULA({"Average"; IF(A4:A="",,
IFNA((MMULT(1*IFERROR(SPLIT(INDIRECT("A4:A"&
MAX(IF(A4:A="",,ROW(A4:A)))), ",")),
ROW(INDIRECT("A1:A"&COLUMNS(SPLIT(A4:A, ","))))^0)/
(1+LEN(REGEXREPLACE(A4:A&"", "[0-9\. ]", ))))/B1))})
spreadsheet demo
Another solution:
=ArrayFormula({"Average";(ArrayFormula(mmult(N(array_constrain(ArrayFormula(IFERROR(SPLIT(A4:A8,","))),MATCH(2,1/(A4:A8<>""),1),5)),sequence(Columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)/mmult(N(array_constrain(if(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))>0,1,0),MATCH(2,1/(A4:A8<>""),1),5)),sequence(columns(ArrayFormula(IFERROR(SPLIT(A4:A8,",")))),1)^0)))/$B$1})
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))
so what Iam trying to do is:
Find a certain string in Spreadsheet1!A:A and give the value that is in B:B right next to the found value in A:A as an output.
My approach:
=VLOOKUP(B1;Spreadsheet1!A:A;Spreadsheet1!B:B)
The Problem:
VLOOKUP wont give strings back as a value. But I need the string for another formula. Is there any workaround, that does not include scripting?
Thank you!
Try this:
=VLOOKUP(B1;Spreadsheet1!A:B;2,False)
B1 should be the value that can be found in Spreadsheet1!A:A