# Thread: Counter based on another field

1. Registered User
Join Date
Feb 2005
Posts
41

## Unanswered: Counter based on another field

I need to find a way to count the number of records in sequence based on two fields:

abc 1234 1
abc 4556 2
def 1234 1
def 4556 2

I need to have column 4 count or sequnece column 2 and reset everytime column 1 changed.

Any ideas or help is apreciated.

Join Date
Feb 2004
Location
New Zealand
Posts
1,475
your message is a bit short

have you tryed =countif(A:A,A1) Then pull it down so next line says =countif(A:A,A2)

U mite have to join some cells =a1&b1 then do the countif on that cell

3. Registered User
Join Date
Feb 2005
Posts
41
Thanks for the quick response I will give that a shot. Think I found another work around that using an If statement but I like your solution a lot better.

Originally Posted by myle
your message is a bit short

have you tryed =countif(A:A,A1) Then pull it down so next line says =countif(A:A,A2)

U mite have to join some cells =a1&b1 then do the countif on that cell

4. Grumpy old man (training)
Join Date
Sep 2006
Location
Surrey, UK
Posts
1,085
Assumption: Your key field is in column A and your counter needs to be in column E.
Cell E2 = 1
Cell E3:
Code:
=IF(A3 = A2, E2+1, 1)
Copy down as required.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•