Count number "increasingly" & "decreasly" after duplicate value

ibmy

Board Regular
Joined
Mar 4, 2020
Messages
103
Office Version
  1. 2016
Platform
  1. Windows
Increasly

Column A - Column B

50 -
10 - (start of duplicate value)
10 - (end of duplicate value)
20 - 1
30 - 2
40 - 3
20 - (no count because the value lower than value from previous cell)
10 -
30 - (start of duplicate value)
30 - (duplicate value)
30 - (end of duplicate value)
20 - (no count because the value lower than duplicate value previous cell)

Decreasly

Column A - Column B

50 -
60 - (start of duplicate value)
60 - (end of duplicate value)
40 - 1
30 - 2
10 - 3
20 - (no count because the value higher than value from previous cell)
10 -
30 - (start of duplicate value)
30 - (duplicate value)
30 - (end of duplicate value)
40 - (no count because the value higher than duplicate value previous cell)


p/s : I tried =IF(A2>A1,"1","0") and =IF(A2<A1,"1","0") but failed when there is increase/decrease value without taking into account duplicate value since my limit knowledge to the excel formula. I only know basic formula.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
See if this does what you want. Formulas start at row 4 because that is the first row that could contain a count value.
Columns A:B for increasing, columns E:F for decreasing

20 05 07.xlsm
ABCDEF
1DataCountDataCount
25050
31060
410 60 
5201401
6302302
7403103
820 20 
910 10 
1030 30 
1130 30 
1230 30 
1320 40 
After Dupe
Cell Formulas
RangeFormula
B4:B13B4=IF(AND(A4>A3,OR(N(B3),A3=A2)),N(B3)+1,"")
F4:F13F4=IF(AND(E4<E3,OR(N(F3),E3=E2)),N(F3)+1,"")
 
Upvote 0
It is not clear from your examples what would cause the count to restart.
When the count does restart, should it start again from 1 or resume at 4 (based on the previous count)?
 
Upvote 0
When the count does restart, should it start again from 1 or resume at 4 (based on the previous count)?
Good question. (y)
For the record, my formula will start from 1 again if a new group of duplicates is encountered & then the relevant increase/decrease happens.

20 05 07.xlsm
ABCDEF
1DataCountDataCount
25050
31060
410 60 
5201401
6302302
7403103
820 20 
910 10 
1030 30 
1130 30 
1230 30 
13401201
14502152
After Dupe
Cell Formulas
RangeFormula
B4:B14B4=IF(AND(A4>A3,OR(N(B3),A3=A2)),N(B3)+1,"")
F4:F14F4=IF(AND(E4<E3,OR(N(F3),E3=E2)),N(F3)+1,"")
 
Upvote 0
Solution
It is not clear from your examples what would cause the count to restart.
When the count does restart, should it start again from 1 or resume at 4 (based on the previous count)?

Sorry @jasonb75, the count restart after find any duplicate value (new duplicate value or previous value) as long as the value is duplicate / repetitive.
When the count restart, it start again from 1.

Here is updated table:-

Increasly

Column A - Column B

30 -
60 -
50 -
10 - (start of duplicate value)
10 - (end of duplicate value)
20 - 1
30 - 2
40 - 3
20 - (no count because the value lower than value from previous cell)
10 -
30 - (start of duplicate value)
30 - (duplicate value)
30 - (end of duplicate value)
20 - (no count because the value lower than duplicate value previous cell)
10 -
10 -
20 - 1
30 - 2
40 - 3
 
Upvote 0
Sorry @jasonb75, the count restart after find any duplicate value (new duplicate value or previous value) as long as the value is duplicate / repetitive.
When the count restart, it start again from 1.
So did you try the formulas that I suggested?
 
Upvote 0
What about the last row in this table, should it be counted? If not, I think that Peter's suggestion will do exactly as needed.
The List.xlsm
AB
1DataCount
250
310
410
5201
6302
7403
820
910
1030
1130
1230
1320
1450???
Sheet16
 
Upvote 0
What about the last row in this table, should it be counted? If not, I think that Peter's suggestion will do exactly as needed.
The List.xlsm
AB
1DataCount
250
310
410
5201
6302
7403
820
910
1030
1130
1230
1320
1450???
Sheet16

No, it should not count since after duplicate value (30, 30, 30) there is value lower than 30, which is 20 so 50 is not count. The count must start right after duplicate value.

Yes, Peter suggestion works. Thank you @jasonb75 for paying attention to my thread and try to help me. :)


So did you try the formulas that I suggested?

Thanks @Peter_SSs , your formula works well. ?
 
Upvote 0

Forum statistics

Threads
1,214,848
Messages
6,121,914
Members
449,054
Latest member
luca142

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