Special counting needed..

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
2,040
Office Version
  1. 2019
Platform
  1. Windows
Hey,

Hope you all doing good. I'm in need of 2 formulas that goes in column C and column D.. or perhaps a code that could give me the results of column C and column D.

Column Column Column Column
A B C D
aap11
aap11
aas12
aas12
aas12
bbi21
bbo22
bbo22
bbr23
bbr23
bbr23
bbu24
bby25
cca31
cca31

<colgroup><col width="64" span="4" style="width:48pt"> </colgroup><tbody>
</tbody>


In above data column C is being calculated from column A's values only. Interestingly column D does the same with column B's values but every time a new value is seen in column A's target.row then the counting resets and starts from 1 again.


If someone could help me out here I'd appreciate it.

Thanks.
 

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.
Start with 1 in C1 and D1. Then put the C2 and D2 formulas in and drag down.

ABCD
1aap11
2aap11
3aas12
4aas12
5aas12
6bbi21
7bbo22
8bbo22
9bbr23
10bbr23
11bbr23
12bbu24
13bby25
14cca31
15cca31

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet10

Worksheet Formulas
CellFormula
C2=IF(A1=A2,C1,C1+1)
D2=IF(C1<>C2,1,IF(B1=B2,D1,D1+1))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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