I'm trying to do a self replicating countifs.
Basically, if Cell C6:C isn't empty, countifs in 3 ranges according to 3 distinct criteria
My individual cell formula is
=if($C6<>"",countifs(data!$K$2:$K,$C6,data!$W$2:$W,"2022",data!$H$2:$H,$C$4),"")
But this isn't self replicating and I need to drag it down all the way down. Is there a way to make this a self replicating formula? I know Array formula doesn't quite work well with Contifs
I tried putting it in an IF formula like this:
=ARRAYFORMULA({"2022"; if(C6:C="","",countifs(data!$K$2:$K,$C6,data!$W$2:$W,"2022",data!$H$2:$H,$C$4))})
But I'm getting the result for C6 repeated all over the cells
Here is an example sheet. 2022 has the method I tried, 2019 the one suggested here on the bottom (that doesn't work) and 2018 has mu current solution which I'm trying to avoid.
The Transpose method might not work since I have almost 20K rows in the "data" sheet.
Thank you.
Without seeing your data it is hard to advise. But if you want to result in array fashion means spill results automatically to each cell in resulting column then can try below formula-
=Arrayformula(IF(Data!$K$2:$K="",,COUNTIFS(Data!$K$2:$K,$C6,Data!$W$2:$W,2022,Data!$H$2:$H,$C$4, ROW(Data!$K$2:$K), "<="&ROW(Data!$K$2:$K))))
My IF formula was actually correct, I just forgot to make it run on C6:C instead of just C6
=ARRAYFORMULA({"2022"; if(C6:C="","",countifs(data!$K$2:$K,$C6,data!$W$2:$W,"2022",data!$H$2:$H,$C$4))})
This is the one that works:
=ARRAYFORMULA({"2022"; if(C6:C="","",countifs(data!$K$2:$K,$C6:C,data!$W$2:$W,"2022",data!$H$2:$H,$C$4))})
Related
Been beating my head against this and can't get it. Here is the forumla:
=IF(E3=E2,F2,F2+1)
Pretty simple. All it does is look at the cell above it...if they are the same it doesn't increase the number iteration. If they are different it does. Somehow I can't figure out how to format this in order to make it an ArrayFormula. The only reason I want it to be an Arrayformula is so that rows can be added or removed and the formula would remain intact thus the spreadsheet would be easier to use.
If you need to place it in column F from F3, you may try another approach or you'll get a circular dependency:
=BYROW(E3:E,LAMBDA(each,IF(each="","",F2+sum(MAP(E3:each, LAMBDA(c,IF(c="","",IF(c=OFFSET(c,-1,),0,1))))))))
try:
=INDEX(BYROW(E2:INDEX(E:E, MAX(ROW(E:E)*(E:E<>""))),
LAMBDA(e, IF(OFFSET(e, 1, )=e, OFFSET(e,,1), OFFSET(e,,1)+1))
I have a large Google Sheets spreadsheet that has individual sheets for financial statements of activity for multiple years. I want to reference particular columns of those in other sheets, and I've successfully figured out how to do that with an HLOOKUP function. However, because I want to do this for multiple years, I'd like that HLOOKUP function to pick up the name of the sheet to reference from its column header. Right now, I'm hard-coding it like this—you can see the HLOOKUP range refers to cells in the "2021 Overall" sheet. The hard-coded approach works but makes adding a new year tedious. Ideally, the HLOOKUP formula would read the contents of its column header cell to determine which year it is.
As best I can tell, the solution is to use INDIRECT, but I can't figure out any way to build the formulate with INDIRECT and not get an error. For instance, this seemed like it should work. As you can see, I have 2021 in cell D4, and my INDIRECT statement is referencing that and building the rest of the range.
I've also tried using INDIRECT with an explicit CONCATENATE, with no more success.
Any ideas for how to look up that D4 cell and slide it into the HLOOKUP range?
Thank you!
Try to remove the "'"& before D4 and the ' after the Overall.
Your formula should look like this:
=IFERROR(HLOOKUP($A$2,INDIRECT(F4 &" Overall!$A$5:$X$150", Utility!$A10, FALSE)))
With Nikko's nudges in the right direction, I eventually figured out the right format. This allows the formula to work in multiple sheets and to be filled right (for more years) and down (for more classes).
=IFERROR(HLOOKUP($A$2,INDIRECT("'"D$4&" Overall'!$A$5:$X$150"), Utility!$A3, FALSE))
Note that if you try to replicate this, you may need to type the formula out from scratch—I had a problem where pasting it in didn't work. Once I'd retyped it and Google Sheets acknowledged it, it worked from then on in the spreadsheet, even when pasted from sheet to sheet.
I have the following formula in cell D2 in a Google Spreadsheet:
=IF(ISBLANK(B2),"",B2-C2)
How do I apply that formula to the whole column D with ArrayFormula? Because ArrayFormula is the best solution, right?
Thanks
Enclose the formula in the google sheets Arrayformula() function. Then change the reference from B2 to B2:B500 (or leave blank for open ended reference). Same for the second reference.
So =ARRAYFORMULA(IF(B2:B="","",B2:B-C2:C)) should work. Note that I changed ISBLANK to X="" since the arrayformula is bound to find values in the entire array so it won't return blank.
--
Whether this is the best way I don't know. The benefit is that this grows with the dataset and avoids errors when you haven't filled the formula far enough down. However it can sometimes slow sheets down (I've heard but not experienced anything severe myself). If you're experiencing slow sheets I recommend Ben Collin's blog on the topic.
Whithout closed ended references
=mmult( arrayformula(1*(ROW(A2:A)<TRANSPOSE(ROW(A2:A)+1))*(ROW(A2:A)>=TRANSPOSE(ROW(A2:A))) -1*(ROW(A2:A)>TRANSPOSE(ROW(A2:A)))*(ROW(A2:A)<=TRANSPOSE(ROW(A2:A)+1)) ) , A2:A)
How would I go about formatting an arrayformula for this?:
=$D10*(sum($F10:$I10))
I've tried a few different ways but none of them work. I have a bunch of rows with that formula (where of course the row number matches, so for example:
=$D10*(sum($F10:$I10))
=$D11*(sum($F11:$I11))
=$D12*(sum($F12:$I12)) etc...
I need this formula in each row but I'm trying to figure out an arrayformula so that it works when I add or subtract rows.
Thanks for your help!
UPDATE************************************************************************
I've just figured out that =arrayformula(D7:D*(F7:F+G7:G+H7:H+I7:I)) works but I might need to add and subtract columns too. Is there a way to make it work with sum()?
I believe MMULT can be a good alternative:
=ArrayFormula(if(len(D2:D), D2:D*mmult(N(F2:I),transpose(column(F2:I2)^0)),))
Change ranges to suit.
The best way to solve math problem is to split it.
You have two multipliers: D x sum(F:F)
The first task is to make ArrayFormula with D. It's simple:
=ArraFormula(D10:D1000)
And the hard part is to make ArrayFormula with sum. This part was already asked and answered here by AdamL. In your case:
=ArrayFormula(SUMIF(IF(COLUMN(F1:I1),ROW(A10:A1000)),ROW(A10:A1000),F10:I1000))
And your final formula is
=ArrayFormula(D10:D1000 *
SUMIF(IF(COLUMN(F1:I1),ROW(A10:A1000)),ROW(A10:A1000),F10:I1000))
I'm trying to find a way to consolidate formulas into 1 cell. As of right now i have 2 mildly complicated formulas using up multiple columns.
I'm trying to put the formulas as an array in a single cell.
To avoid confusing the matter, i've only included a simplified version of the formulas and only using 1 column.
Edit:
Here is the Spreadsheet in question, the Better Mobs sheet
Ok, so i tried to implement the solution and it didn't work the way i needed. Before i consolidate and just use 1 spreadsheet, the full formula in cell F1 is:
=match(max(F2:F),F2:F,0)+1&" - "&INDIRECT("A"&match(max(F2:F),F2:F,0)+1)
and cell F2 is:
=IFERROR(E269/ROUNDUP($C269/MAX(0,importrange("1rkS5zujl6oo66JNbhb8yWOjgOqRoXhvyGa-nr95krJ4","Damage Reward!$B$26")/2-$K269)*MAX((MIN(100+sqrt(importrange("1rkS5zujl6oo66JNbhb8yWOjgOqRoXhvyGa-nr95krJ4","Damage Reward!$B$27"))-sqrt(O269)-MAX($B269-importrange("1rkS5zujl6oo66JNbhb8yWOjgOqRoXhvyGa-nr95krJ4","Damage Reward!$B$3"),0)*5,100)/100),0)*2),"")
Does this formula work as you want in cell C1:
={MAX(ArrayFormula(IFERROR(B2:B*D2:D/E2:E)));ArrayFormula(IFERROR(B2:B*D2:D/E2:E))}