Excel Compare Columns and Increments

dygitaldude

New Member
Joined
Apr 29, 2017
Messages
10
Please help!

This is my first time posting. Please excuse me, if I'm not clear enough. I'm trying to figure out a way to number the rows as in Col C below. The first instance of Col A should be numbered 1, if subsequent value is same as Col B then 1 or increment 1.

Thanks



ABC
1100Bat1
2100Ball2
3100Glove3
4200Bat1
5200Bat1
6200Ball2
7200Ball2
8200Glove3
9200Glove3
10300Ball1
11300Glove2

<tbody>
</tbody>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
In cell C1, set the value 1.
In cell C2 put the following formula and the copies down

=IF(A1=A2,SI(B1<>B2,C1+1,C1),1)
 
Upvote 0
If you have up-to-date Excel365 Insider, this formula will work. It uses the new Excel functions UNIQUE and FILTER.

C1:
Code:
[FONT=Verdana]=MATCH(A1&B1,UNIQUE(FILTER($A$1:$A$11&$B$1:$B$11,$A$1:$A$11=A1)),0)[/FONT]
 
Last edited:
Upvote 0
In cell C1, set the value 1.
In cell C2 put the following formula and the copies down

=IF(A1=A2,SI(B1<>B2,C1+1,C1),1)

Hello Dante,

The formula did not work unless I did something incorrect :(

A
B
C
100
Bat1
100
Ball
#NAME?
100
Glove
#NAME?
200bat
1
200bat
#NAME?
200ball#NAME?

<colgroup><col style="width:48pt" width="64" span="3"> </colgroup><tbody>
</tbody>
 
Upvote 0
Hello Dante,

The formula did not work unless I did something incorrect :(

ABC
100Bat1
100Ball#NAME?
100Glove#NAME?
200bat1
200bat#NAME?
200ball#NAME?

<tbody>
</tbody>

Sorry, this is the correct formula:

=IF(A1=A2,IF(B1<>B2,C1+1,C1),1)

Try again
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

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