Find the biggest change in values in a list? - excel

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)

Related

Sum column dynamically

Having A1+C1 and B1+D1 in two cells how can I dynamically set up a formula to catch if some column is added.
Let's say the user adds two columns in the middle. I should have A1+C1+E1 and B1+D1+F1.
I thought it would have been automatic but it is not.
Replace:
=A1+C1
By:
=SUM(A1:C1) - B1
In case you want to check if the column number is divisble by three, you can use following formula:
=IF(MOD(COLUMN(A1);3)=0;A1;0) // I've put the values from 1 to 10 in A1-J1
// and I've dragged this formula from A2 to J2,
// the values were 0,0,3,0,0,6,0,0,9,0.
Unfortunately I don't have a simple way to sum those values in one easy formula.
If you always add two columns then A1+C1 will always be looking at odd number columns and B1+D1 will always be looking at even numbered columns.
{=SUM(IF(ISODD(COLUMN($A$1:$D$1)),$A$1:$D$1))}
and
{=SUM(IF(ISEVEN(COLUMN($A$1:$D$1)),$A$1:$D$1))}
As long as you insert columns between A:D the ranges will extend to accommodate.
Edit:
Based on the comment that row 2 contains codes and row 3 contains the figures to add up for each code then this array formula will work:
{=SUM(IF($A$2:$J$2="H1",$A$3:$J$3))}
Edit2: and if I wake up you can even use the non-array and built in formula:
=SUMIF($A$2:$J$2,"H1",$A$3:$J$3)
The H1 text can be changed to another code or to a cell reference containing the code to get the sum of values in row 3 for the specified code.
As an array formula it must be entered using Ctrl+Shift+Enter.

excel SUMIFS only on same date

I'm trying to create a formula in column K which sums all cells that apply , in column J, only when the following conditions are true:
dates are the same in column A
AND client name is the same in column B
For example, in cell K2, I want the sum of J2+J3+J4 because A2=A3=A4 and B2=B3=B4.
K5=J5 only, because there are no other dates with the same client name.
K6=J6+J7 because A6=A7 and B6=B7.
What kind of formula would I use for this? I can't figure out how to do it with a SUMIFS.
I would try using a pivot table with:
The names as row values
The dates as the column values
And funds received using SUM in the values column
Edit
Based on #pnuts comments here is how to get the values in column K. Put this in K2 and drag down.
=IF(OR(COUNTIFS($B$1:B3, B3) = 1, B3 = ""), SUMIFS($J$2:J2, $A$2:A2, A2, $B$2:B2, B2), "")
This formula will give blank values until the formula finds a new client on a new date. However, I still think using pivot table is a better solution.
However, I still find the pivot table
In cell K2 put following formula:
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,SUMIFS($J$2:$J$10,$A$2:$A$10,A2,$B$2:$B$10,B2),"")
Adjust row 10 value. It will be last row of your actual data.
Copy down as much you need.
EDIT
Uploaded file shows the cause behind formula not working correctly for you. It turned out to be whitespace characters in column B (names) data e.g.
Cell B3: "Moe John" has a trailing space.
Cell B10: Same case with "Doe Jane"
If you want to use above posted formula then all names shall be corrected. Or alternatively to deal with spaces you can adopt below approach.
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,"*"&TRIM(B2)&"*")=1,SUMIFS($J$2:$J$28,$A$2:$A$28,A2,$B$2:$B$28,B2),"")
Notice the change in COUNTIFS formula where B2 is now replaced with "*"&TRIM(B2)&"*".
Even such formula will take a beating if you have uneven whitespace characters in between your data. I'd suggest normalizing it as much as possible.

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.

Vlookup to check two conditions

I am referring to below my google spreadsheet
https://docs.google.com/spreadsheets/d/1dCfShenhV2j98q5wkOXMeyWj9tlMZbaBgBqB2vAPdHo/edit?usp=sharing
I am looking to update H,I and J columns using vlook formula in way that it should match both name and date values in my data range, which in A,B and C columns
Here is the issue I am facing with normal vlookup is that I can check only name.It is ignoring the date and updating the vlooked up data on all date column.
Eg: Alpha and date 20141120 value is 10, it should fill only H3, but it is updating, H3 I3 and J3 with value 10
I really appreciate your answer on this problem!!!
you can use this formula of index and match:
=IFERROR(INDEX($A:$C,MATCH(1,($A:$A=$G3)*($B:$B=H$2),0),3),"")
paste it in the first cell of your table H3, and drag and fill to the right and then select the entire row and fill down till end.
it should work.
if error(();"") : you will get empty cells if there is no match.
this is an array formula, so press ctrl+shift+enter to calculate the formula
UPDATE: here is [the example sheet downloadable from here}(https://www.dropbox.com/s/clqxsj5j4bdk27b/indexmatch.xlsx?dl=0)
Basically you need to concatenate the results, then use a VLOOKUP on that.
I.e. insert a column between B and C, with formula "=CONCATENATE(A2,B2)"
In the range you want to update, use the column and row headings for you lookup
"=VLOOKUP(CONCATENATE($g3,h$2),$c$1:$d$3,2,false)"
You want to perform a Multiple Lookup (see this).
As indicated there, enter
=IFERROR(LOOKUP(2,1/($A$1:$A$3=$G3)/($B$1:$B$3=H$2),$C$1:$C$3),"")
in H3. Copy into H3:J5.
This avoids array formulas.

What is the excel formula for "if a cell is one of N top values of the column"?

Column A has 50 random values (from A1 to A50). I'm trying to make formula for each cell of column B. The formula is: if the value of left cell is one of top 3 values of column A, then write "Yes", else write "No". I tried to use this in cell B1:
=IF(A1=LARGE(A1:A50,{1;2;3}),"Yes","No")
But it doesn't work perfectly because it only works on the largest value, not the second and third values.
Any suggestions? Thanks in advance.
the first and second-largest values are larger than (or equal to) the 3rd largest, so:
=IF(A1>=LARGE($A$1:$A$50,3),"yes","no")
You could use:
=IF(A1>LARGE(A1:A50,4),"Yes","No")
You might also consider:
=IF(RANK(A1,$A$1:$A$50)<=3,"yes","no")

Resources