Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

conditional runing number in Excel 2007 1

Status
Not open for further replies.

johnhugh

Technical User
Mar 24, 2010
702
SG
Hi,

I have a spreadsheet like below and require the numbering to be like shown in the 3rd column.
Basically if the numbers in the first column and the string in the 2nd coloumn are identical to the previous row it starts counting. Other wise just give me a 1.

Thats the formula I come up with but the counting is not right.
=IF(AND($A1=$A2,$C1=$C2),COUNTA(A1:$A1)

101010100002 20-SDV01-USD 1
101010100003 20-SDV01-USD 1
101010100007 20-BML01-ZMK 1
101010100007 20-BML01-ZMK 2
101010100007 20-BML01-ZMK 3
101010100007 20-BML01-ZMK 4
101010100007 20-BML01-ZMK 5
101010100007 20-DEQ01-ZAR 1
101010100007 10-SFI02-AUD 1
101010100026 24-SFI01-USD 1

Any help much appreciated.
 



Hi,
[tt]
=SUMPRODUCT(($A$1:A1=A1)*($C$1:C1=C1))
[/tt]



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



If you had a Heading row, and EVERY table SHOULD have a heading row and NEVER start with data in A1, then this formula would also work...
[tt]
D2: =IF(AND(A2=A1,C2=C1),D1+1,1)
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



and since you're using Excel 2007, you could also use the COUNTIFS function...
[tt]
=COUNTIFS($A$1:A1,A1,$C$1:C1,C1)
[/tt]

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top