Google Sheet Arrayformula with multiple mathematical functions - google-sheets

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

Related

How to convert this formula into an arrayformula? Google Sheets

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

Google Sheets - Calculate sum of row results - by using one-liner formula

In some column have formula like below:
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2))
I have expanded it in 3 rows (A1:A3):
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2))
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M3);0);L3))
=SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M4);0);L4))
And I'm getting right results.
Then I want to get sum of those. But I need to create all of above in one line.
I mean - I don't want to calculate above separately and then do something like SUM(A1:A3).
I was trying with ARRAYFORMULA() but with no success, yeah, how hard can it be, right?
Have a nice evening!
UPDATE:
If someone will look for the solution, the best one is Mike's solution. Take a look at picture what he has added.
I have just extended it to filter L and M columns and it does not matter how long columns are. Of course L and M columns have to have the same number of elements ;)
=SUM(MMULT(ARRAYFORMULA(--(G2:G=TRANSPOSE(FILTER(M2:M;ISTEXT(M2:M))))*(H2:H));FILTER(L2:L;ISNUMBER(L2:L))))
You should be able to nest the evaluations inside a SUM, like the below and get a SUM of the SUM's so to speak.
=SUM(SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M2);0);L2)),SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M3);0);L3)),SUM(MMULT(IFNA(FILTER($H$2:$H;$G$2:$G=M4);0);L4)))
There probably is a more efficient way, but why over complicate it. :)
Try this
=sum(mmult(arrayformula(--(G2:G=transpose(M2:M4))*(H2:H)),L2:L4))
the formula =arrayformula(--(G2:G=transpose(M2:M4))*(H2:H)) will give you a matrix as follows, then apply mmult

Google Sheets: Is it possible to simplify this formula? Preferably, I'd like it to calculate all the cells in the row

Can the following formula be simplified as described in the paragraph below it?
=(ABS(D$3-D5)+ABS(E$3-E5)+ABS(F$3-F5)+ABS(G$3-G5)+ABS(H$3-H5)+ABS(I$3-I5)+ABS(J$3-J5)+ABS(K$3-K5))/-1
The problem is that I don't know how many columns I'm going to end up with, and I certainly don't want to continue manually writing each column into the formula. Is there I way to simplify this formula so that every column in a row is calculated?
I've been trying various formulas to no avail, and I can't get usable results via Google searches. I suppose I don't know how to effectively word the question without writing a paragraph.
Thanks, in advance!
Try this one:
=-SUM(ARRAYFORMULA(ABS(D$3:$3 - D5:5)))
GOT IT:
=ArrayFormula(SUM(ABS(D$3:$3-D5:5))/-1)

Arrayformula Unique Entries

This is the example sheet.
I'm trying to combine options together but sort out duplicates. Right now, ={"Options";ARRAYFORMULA()} is in v1!A1 because every other formula I've thought of is a lot of IF() functions stringed together going through each and every combination. Is there a better way to do this?
EDIT:
The delimiter is , , not a space.
Difficult to do as an array formula, but a fairly simple pull-down formula would be:
=textjoin(",",true,UNIQUE(transpose(B2:2)))

Google Sheets, Is it possible to use Arrayformula to expand formulas downward when the formula uses arrays

I've been using Arrayformula to auto-expand formulas (such as "=Left(A2:A,B2:B-1") downward, but I need some help understanding this formula. I've read up on the function itself and browsed many forums about this but I can only find articles explaining how to use this with simple formulas, so I'm going to try to as this as simply as possible here: Is it possible to use Arrayformula to expand formulas downward when the formula uses arrays?
The summary for Arrayformula reads "Enables the display of values returned from an array formula into multiple rows and/or columns and the use of non-array functions with arrays." This was my understanding of how Arrayformula populated a formula into rows automatically. Using this I thought of it as writing a formula that generated an array of formulas, and then splitting them up with Arrayformula. This seems to not work with some formulas such as concatenate, which I will focus my question on. This example is far from my real life problem, but if someone could show me a solution I can apply it elsewhere.
Arrayformula spreadsheet example
Usually when I use Arrayformula with A1:A it would expand the formula through the column, referencing the corresponding rows as it went. With this example I want to have Column C be the concatenated result of columns A and B. Is this possible with Arrayformula? This question is not specific to concatenate, that is just the simplest one that came to mind. Another example would be Countif. Lets say I want to see how many values in the first 5 columns are over 20, and I want that formula to auto populate down, is that possible and if so how would it be done?
Arrayformula second example
P.S. Please don't say copy the formula using the drag handle in the lower right.

Resources