Sum of the smaller value between two columns - excel

i want to find the sum of a row based only by the cells with a value smaller than the row below them.
So, i want to have the sum of all the cells of the row B14:R14, that are smaller than the cell below.
Ex: B14:D14 are bigger than the cells below(B15:D15) but E14 and G14 is smaller so I sum all of them.
Thank you.

Is this what you mean?:
using the formula
=SUMPRODUCT(E5:E16,N(E5:E16<E6:E17))
or in a slightly more elegant way written as
=SUMPRODUCT(E5:E16,N(E5:E16<OFFSET(E5:E16,1,0)))
Although it should be noted that the OFFSET() function is a volatile function

Related

Countifs does not work when a range with multiple column is selected

I need a count if function that counts me the cells that meet a certain criteria. This should be done with countifs. The formula is the following:
=COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:Q;">=1")This formula returns me an value type error.
This formula works well until I introduce the last condition orders!K:Q;">=1"
I would like a formula that counts if the word Ecolab is present in the cell; if the date is after or equal 01/01/2019; if the column U has more or equal than the number 36 and if there is at least a "1" in the cells in the row from column K to column Q. I could do this by easily replicating the countifs several times, (i.e =COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!K:K;">=1")+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!L:L;">=1")+...........+COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";Orders!Q:Q;">=1")
But I would rather not include such a long formula as it would create confusion for the ultimate user of the excel sheet
Per my comment above, you could use SUMPRODUCT (avoid using whole columns for that) or an array with OFFSET like this:
=SUM(COUNTIFS(Orders!D:D;"*Ecolab*";Orders!B:B;">=01/01/2019";Orders!U:U;">=36";OFFSET(Orders!J:J;0;{1;2;3;4;5;6;7});">=1"))
If the count for K:Q should be 1 when there may be more than one cell greater or equal to 1 in a single row then you need to apply OR criteria in a SUMPRODUCT.
SUMPRODUCT formulas should not use full column references; there is too much wasted calculation. The following is for rows 2:99; adjust for your own use.
=SUMPRODUCT(--ISNUMBER(SEARCH("ecolab", Orders!D2:D99)),
--(Orders!B2:B99>=DATE(2019, 1, 1)),
--(Orders!U2:U99>=36),
SIGN((Orders!K2:K99>=1)+(Orders!L2:L99>=1)+(Orders!M2:M99>=1)+(Orders!N2:N99>=1)+(Orders!O2:O99>=1)+(Orders!P2:P99>=1)+(Orders!Q2:Q99>=1)))

Excel SumIF with range as Column and Sum range as ROW

I am trying to make this work:
=SUMIF(MATRIX!$B$2:$B$36,"YES",B5:AJ5)
Note that the range is a COLUMN and the sum range is a ROW but when the formula computes it doesn't sum the Row B5:AJ5 it actually sums B5:B40. What do I need to add to have it sum the ROW and not the COLUMN.
EXAMPLE:
As you have discovered, a SUMIF expects both the criteria array and the sum array to be both rows or columns but not one of each. You have correctly used the same number of cells in each; the problem is that they are in different directions. A TRANSPOSE function can reverse the direction that the outer function 'sees' the one of the arrays but you need to change from SUMIF to SUMPRODUCT and enter it as an array formula with Ctrl+Shift+Enter.
=SUMPRODUCT((B$2:B$5="yes")*(TRANSPOSE($H2:$K2)))
When entered correctly with CSE, the result in L2 is 2.3. Fill both right and down for something resembling the following.
I don't believe you can use transpose with SUMIF but someone might know a trick to it.

Sum of Max functions using an array formula Excel

I'm trying to find a formula that results in the following:
sum(max(a,b),max(c,d),....)
I tried using =SUM(MAX(0,($D$1:$P$1)-$P$3) as an array formula, but this results in excel taking the maximum of all the entries, instead I want the sum of all maximums.
You want to sum a range, say A1:H1 if it's greater than a cell, say H3. But you don't want to sum the total, you want to sum the differences between the cells in the range that meet the criteria and the cell they are being compared to, right?
=SUMIF(A1:H1,">"&H3)-(COUNTIF(A1:H1,">"&H3)*H3)
It doesn't need to be entered with ctrl shft entr as sumif is already an array formula. Adapt to your conditions as needed.
=SUMPRODUCT((D1:P1-P3>0)*(D1:P1-P3))
The first set of parens returns a bunch of Trues and Falses. When multiplied, Trues are like 1's and Falses are like 0's. So when something is below zero, it gets multiplied by zero and becomes zero.

Excel SUMIF function sums multiple and/or wrong column.

I'm having an issue getting accurate data from the SUMIF function. This appears to be caused by the SKU and Product name being identical however I don't understand why the selected range would be ignored.
SUMIF(G:K,A2,K:K) - Cell D2 is calling for the sum of K yet returning the sum result of K2:M2. All other results in D are correct.
SUMIF(G:K,A2,I:I) - If I change the formula in D to SUM I:I (text not a numeric field) the function returns the sum of K:K
Example file http://tempsend.com/013C2B6378
According to the documentation here the range to be summed starts at the top left of the sum range (K:K in your first example) but its size is given by the size of the criteria range (G:K in your example). So I think that's why you're getting extra columns summed in your result.
If you have multiple criteria involving different columns, you should be able to use SUMIFS.
So let's say your data sit in 8 rows (including the headings).
then you simply need to change your formula to say, look for B2 in column G OR in I, if true, then sum the values in K. Right?
put this formula in B2 and press ctrl+shift+enter to calculate the formula.
=SUM(IF(($G$2:$G$8=B2)+($I$2:$I$8=B2),1,0)*$K$2:$K$8)
then drag and fill down until the last cell.
obviously you need to adjust the ranges in the formula to adapt to your own data.
tell me if you get to the answer via this.

Find the biggest change in values in a list?

How would you find the biggest difference/change in values of a list of numbers in Excel?
An example of what I'm looking for is 1,3,4,5,9,10,11,13
The value I would look for is 4 as this is the biggest difference (between 5 and 9).
Is there a way to do this with a list in Excel?
A picture is worth a thousand words? :p
EDIT:
Description added:
As shown in the image, put the formula in =A2-A1 in Cell B2 and then drag it down. Once you have your values, use the Max formula to get the maximum value as shown in Cell D5
Add another column to contain the difference. Assuming your values are in column A, then the formula would be "=A2-A1" copied down the list. Few ways after this.
(1) You can eyeball which is largest
(2) you can copy values (make sure is values) to a this column and sort descending
(3) You can build pivot off that this column. and double click the largest to find the detail
If values are in distinct cells (A1:A8):
=MAX($A$2:$A$8-$A$1:$A$7)
seems to work (as an array formula, enter with Ctrl+Shift+Enter).
Put the values in a column.Say, Column A
In cell B1; write a formula. =A2-A1
Copy the same formula to the entire Column B, for every value in column A
Go to the end of column B, and write a new formula, =MAX (B1:B)
Create a new column with the differences:
=A2-A1
And drag down.
Find the max value:
=MAX(B1:B9)
Find the index of the max difference value:
=MATCH(MAX(B1:B9);B1:B9;0)

Resources