Successive increases/decrease count

All2Cheesy

Board Regular
Joined
Mar 4, 2015
Messages
127
Hi all,

I'm looking to create a count for the number of successive increases or decreases in my data set.
I'm not sure if this can be done, and I'm struggling to think of a way to get started on this. Would anyone have any suggestions? Example is below.


April
May
June
Company 1
$150
$200
$300
Company 2
$400
$200
$30
Company 3
$400
$300
$600

<tbody>
</tbody>

Company 1 should return +3 (Because it ended with 3 successive increases)
Company 2 should return -3 (Because it ended with 3 successive decreases)
Company 3 should return +1 (Because it ended with 1 increase)
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
*EDIT* The second formula isn't showing, but it essentially the same as the first formula, only in using < instead of >

I've created 3 formulas which achieve that I want (2 are hidden). However, they are very long, and at this point I would be looking for a way to condense them. Any suggestions?

Ex. Form1
Code:
=IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2,J2>I2,I2>H2,H2>G2,G2>F2,F2>E2),11,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2,J2>I2,I2>H2,H2>G2,G2>F2),10,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2,J2>I2,I2>H2,H2>G2),9,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2,J2>I2,I2>H2),8,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2,J2>I2),7,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2,K2>J2),6,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2,L2>K2),5,IF(AND(P2>O2,O2>N2,N2>M2,M2>L2),4,IF(AND(P2>O2,O2>N2,N2>M2),3,IF(AND(P2>O2,O2>N2),2,IF(AND(P2>O2),1,0)))))))))))

Ex. Form2
Code:
=IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2,J2<I2,I2<H2,H2<G2,G2<F2,F2<E2),11,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2,J2<I2,I2<H2,H2<G2,G2<F2),10,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2,J2<I2,I2<H2,H2<G2),9,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2,J2<I2,I2<H2),8,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2,J2<I2),7,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2,K2<J2),6,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2,L2<K2),5,IF(AND(P2<O2,O2<N2,N2<M2,M2<L2),4,IF(AND(P2<O2,O2<N2,N2<M2),3,IF(AND(P2<O2,O2<N2),2,IF(AND(P2<O2),1,0)))))))))))

Ex. Form3 (Shown)
Code:
=IF(AND(U2=0,V2=0),0,IF(U2=0,"-"&V2,"+"&U2))
 
Upvote 0
Here's a more general formula, with sample results. I'm guessing that you score 0 if value stays the same?

G2: =(COLUMN(F2)-COLUMN($B2)-MAX((COLUMN($B2:E2)+1-COLUMN($B2))*(SIGN($C2:F2-$B2:E2)<>SIGN(F2-E2))))*SIGN(F2-E2)

Excel 2010
ABCDEFG
1AprilMayJuneJulyAugustScore
2Company 1$150$200$300$350$400+4
3Company 2$400$200$30$20$10-4
4Company 3$400$300$600$650$600-1
5Company 4$200$175$175$180$185+2
6Company 5$200$175$190$180$170-2
7Company 6$200$175$190$180$200+1
8Company 7$200$175$190$180$1800
9Company 8$200$180$200$180$160-2

<tbody>
</tbody>
Sheet1

<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2,g2<f2,f2<e2),11,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2,g2<f2),10,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2),9,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2),8,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2),7,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2),6,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2),5,if(and(p2<o2,o2<n2,n2<m2,m2<l2),4,if(and(p2<o2,o2<n2,n2<m2),3,if(and(p2<o2,o2<n2),2,if(and(p2<o2),1,0)))))))))))[ code]

</o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2,g2<f2,f2<e2),11,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2,g2<f2),10,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2,h2<g2),9,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2,i2<h2),8,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2,j2<i2),7,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2,k2<j2),6,if(and(p2<o2,o2<n2,n2<m2,m2<l2,l2<k2),5,if(and(p2<o2,o2<n2,n2<m2,m2<l2),4,if(and(p2<o2,o2<n2,n2<m2),3,if(and(p2<o2,o2<n2),2,if(and(p2<o2),1,0)))))))))))[>
 
Upvote 0
The count resets back to 0 if there are two values which are the same. (This is every rare).

But that formula looks like it might just about do what I need.
 
Upvote 0

Forum statistics

Threads
1,215,049
Messages
6,122,864
Members
449,097
Latest member
dbomb1414

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