I'm trying to make the following formula a bit less redundant, as it may grow out of proportion with some of the modifications i'm looking to perform.
Any advice would be appreciated.
=minus(SUMIFS(A$2:$A,C$2:$C,K$3)-sumifs(A$2:$A,C$2:$C,K$2),SUMIFS(A$2:$A,C$2:$C,K$5)-sumifs(A$2:$A,C$2:$C,K$4))
Please see the worksheet
Try this standard formula:
=SUMPRODUCT($A$2:$A$1000,($B$2:$B$1000=$C$3)+($B$2:$B$1000=$C$4))
-SUMPRODUCT($A$2:$A$1000,($B$2:$B$1000=$C$2)+($B$2:$B$1000=$C$5))
Basically groups the result of the criteria to be added and the ones to be subtracted
Related
I apologize in advance, when it comes to things like formulas, I have very little knowledge.
I have attempted to refine my formula for many hours with ChatGPT with no luck so far.
I had previously asked a question here & was able to find a solution to my formula.
This is the current working formula that a kind member provided to me in my previous question:
=sumproduct(('Online Arbitrage'!$A$10:$A=D8)*('Online Arbitrage'!$M$10:$M>=DATE(A5,1,1))*('Online Arbitrage'!$M$10:$M<=DATE(A5,12,31))*('Online Arbitrage'!$N$10:$N>0)*'Online Arbitrage'!$H$10:$H*'Online Arbitrage'!$N$10:$N)
I have an additional column that I would like to pull similar data for but with one additional criteria:
('Online Arbitrage'!$U$10:$U="Exempt")
My hope is that it will calculate all of the same data from the previous formula but only pull through the items with the "Exempt" label in column U (for total tax exempt purchase).
I have attempted to add this additional criteria all over the working formula with no success.
Does anyone know how I can add this additional criteria into this formula?
Thanks!
Try:
=sumproduct(('Online Arbitrage'!$A$10:$A=D8)*('Online Arbitrage'!$M$10:$M>=DATE(A5,1,1))*('Online Arbitrage'!$M$10:$M<=DATE(A5,12,31))*('Online Arbitrage'!$N$10:$N>0)*'Online Arbitrage'!$H$10:$H*'Online Arbitrage'!$N$10:$N*('Online Arbitrage'!$U$10:$U="Exempt"))
My goal is to simplify this formula. The problem is, I have limited knowledge of Excel. So I rely on the If logical operators. And, as consequence, the if formula is quite long for just 1 column.
The overview:
The current formula:
=IF(G10<C$3,F10>D$3, IF(G10<C$4,F10>D$4, IF(G10<C$5,F10>D$5, IF(G10<C$6,F10>D$6, IF(G10>C$7,F10>D$7)))))
Just thought of another idea:
=INDEX(IF(F11:F<>"",LOOKUP(G11:G,C3:C7,D3:D7)<F11:F,""))
This will now spill-down results and will update these when you add more data.
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
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)
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))