counting the number of times a number appears in a list

bearcub

Well-known Member
Joined
May 18, 2005
Messages
701
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I was working on a project where I have items that appear in a list multiple times. They are all sorted alphabetically and I wanted to get a formula that would count it appears while going down each row.

If had a list of 3 items in Range(A1:A3) I would have a formula in column B that would increment by 1 for each time it appears after the 1st occurence.

Code:
Col A  col B
A        1
A        2
A        3 
B        1
B        2
B        3 
C        1
C        2
C        3

This is the pattern that I would like to see in Col B. I tried using Countifs but I forgot how to increment it after the 1st occurence and start over again when the value in Col A changes.

Thank you for your help

Michael
 

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.
to increment the COUNTIF use

Code:
=COUNTIF($A$1:A1,"A")

and copy down.
Obvioulsy this will only work in the instance of "A"
 
Upvote 0
thank you, that was the formula. I was using ">1" for the second argument.
 
Upvote 0

Forum statistics

Threads
1,214,587
Messages
6,120,406
Members
448,958
Latest member
Hat4Life

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