Increment value based on multiple criteria

tinkythomas

Active Member
Joined
Dec 13, 2006
Messages
432
Hi,

I want to increment a number in an adjacent column to my data based on 2 criteria. Firstly the value in ColA is the same and the value in ColB is the same.

For example the following data...

ColA, ColB
E6322001, T1
E6322001, T1
E6322001, T2
E6322001, T2

The result I'm after a count in ColC...
ColA, ColB, ColC
E6322001, T1, 1
E6322001, T1, 2
E6322001, T2, 1
E6322001, T2, 2

I tried using the CountA function (COUNTA($A$1:A1)) but that only counts the 1 column and I end up with...

ColA, ColB, ColC
E6322001, T1, 1
E6322001, T1, 2
E6322001, T2, 3
E6322001, T2, 4

Any help would be appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hello,

C1, copy down.

=COUNTIF(B$1:B1,B1)

If you want to Count Col_A & Col_B,

C1, copy down.

=SUMPRODUCT(--(A$1:A1=A1),--(B$1:B1=B1))

Excel 2007 or later,

C1, copy down.

=COUNTIFS(A$1:A1,A1,B$1:B1,B1)
 
Last edited:
Upvote 0
If you want to Count Col_A & Col_B,

C1, copy down.

=SUMPRODUCT(--(A$1:A1=A1),--(B$1:B1=B1))
Thank you very much the SUMPRODUCT function gives me the desired result.

I must confess that I don't really understand how this function works? If you don't mind could you please explain how it works?

Thank you,
 
Upvote 0
Thank you very much for the link. I now understand a little better! It's like anything else, the more you use something in real world scenarios the easier it is to uderstand.

Regards,
 
Upvote 0
Thank you very much for the link. I now understand a little better! It's like anything else, the more you use something in real world scenarios the easier it is to uderstand.

Regards,
You're welcome. Thanks for the feedback! :cool:
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
Members
452,902
Latest member
Knuddeluff

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