Finding the biggest gap

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Looking for a function/formula to work out the largest difference between successive years. Column H illustrates what the result should be.
As a follow-up, how would the formula need to change if the original data wasn't sequenced eg Sam 1945 1968 1930 1990.


Book6
ABCDEFGH
2Year 1Year 2Year 3Year 4Year 5Year 6Biggest difference
3Sam193019451968199023
4Jack19501976201034
5Tom19031947195319771985202044
Sheet4
 
Book7
ABCDEFGHIJ
1Year 1Year 2Year 3Year 4Year 5Year 6Biggest differenceYear MaxYear Min
2Sam19301945196819902319681945
3Jack1950197620103420101976
4Tom1903194719531977198520204419471903
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=MAX(C2:G2-B2:F2)

Desired output in columns I and J.
Ties would be an issue and are certain to occur, if that complicates things too much, I'm ok with the assumption that there are no ties.
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Ties would be an issue and are certain to occur, if that complicates things too much
To help assess if it complicates things too much I was hoping that raising the issue would ensure that you included at least one example like that with your latest sample & results. ;)
Could you do that please?
 
Upvote 0
To help assess if it complicates things too much I was hoping that raising the issue would ensure that you included at least one example like that with your latest sample & results. ;)
Could you do that please?
Ok,
Book7
ABCDEFGHIJKL
1Year 1Year 2Year 3Year 4Year 5Year 6Biggest differenceYear MaxYear MinYear Max (tied result)Year Min (tied result)
2Sam1930194519681991231968194519911968
3Jack1950197620103420101976
4Tom1903194719531977198520204419471903
Sheet1
Cell Formulas
RangeFormula
H2:H4H2=MAX(C2:G2-B2:F2)
 
Upvote 0
Thanks. Try these. Column I Formulas copied to columns K, M, etc and column J formulas copied to columns L, N, etc

TigerExcel.xlsm
ABCDEFGHIJKLMN
1Year 1Year 2Year 3Year 4Year 5Year 6Biggest differenceYear MaxYear MinYear Max (tied result)Year Min (tied result)Year Max (tied result)Year Min (tied result)
2Sam1930194519681991231968194519911968  
3Jack1950197620103420101976    
4Tom1903194719531977198520204419471903    
5Jen2000200220042005200620082200220002004200220082006
Sheet3
Cell Formulas
RangeFormula
H2:H5H2=MAX(C2:G2-B2:F2)
I2:I5,K2:K5,M2:M5I2=MID(CONCAT(IF($C2:$G2-$B2:$F2=$H2,$C2:$G2,"")),COUNTIF($I$1:I$1,"*Max*")*4-3,4)
J2:J5,L2:L5,N2:N5J2=MID(CONCAT(IF($C2:$G2-$B2:$F2=$H2,$B2:$F2,"")),COUNTIF($I$1:J$1,"*Min*")*4-3,4)
 
Upvote 0
Thanks. Try these. Column I Formulas copied to columns K, M, etc and column J formulas copied to columns L, N, etc

TigerExcel.xlsm
ABCDEFGHIJKLMN
1Year 1Year 2Year 3Year 4Year 5Year 6Biggest differenceYear MaxYear MinYear Max (tied result)Year Min (tied result)Year Max (tied result)Year Min (tied result)
2Sam1930194519681991231968194519911968  
3Jack1950197620103420101976    
4Tom1903194719531977198520204419471903    
5Jen2000200220042005200620082200220002004200220082006
Sheet3
Cell Formulas
RangeFormula
H2:H5H2=MAX(C2:G2-B2:F2)
I2:I5,K2:K5,M2:M5I2=MID(CONCAT(IF($C2:$G2-$B2:$F2=$H2,$C2:$G2,"")),COUNTIF($I$1:I$1,"*Max*")*4-3,4)
J2:J5,L2:L5,N2:N5J2=MID(CONCAT(IF($C2:$G2-$B2:$F2=$H2,$B2:$F2,"")),COUNTIF($I$1:J$1,"*Min*")*4-3,4)
Thanks Peter, that works nicely.
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top