" REQUIRED"字段是需要填充的字段,
它应该是这样的。
http://s2.postimg.org/nketog5t5/table.jpg
Serial Number REQUIRED Starred SEQ_NO
040846/Z/96/C 1 * 1
040846/Z/96/C 2 * 2
040846/Z/96/C 3
042190/Z/96/F 1 * 1
042368/Z/97/B 1 * 1
042368/Z/97/B 2
042368/Z/97/B 2 * 3
042368/Z/97/B 4
042368/Z/97/B 3 * 5
042368/Z/97/B 6
042368/Z/97/B 7
042368/Z/97/B 8
047608/Z/96/B 1 * 1
047608/Z/96/B 2
047675/Z/96/D 1 * 1
047675/Z/96/D 2 * 2
047675/Z/96/D 3
答案 0 :(得分:2)
将此公式粘贴到您尝试填充的列中。如果你关心它,你可以稍微调整它以隐藏零。
=COUNTIFS($A$2:A2,A2,$C$2:C2,"*")
请注意硬参考与该公式中的相对参考,并确保您的条目与这些条目一致。
答案 1 :(得分:1)
请试试这个
Sub increment()
Dim prevalue As String
Dim curvalue As String
Dim lstrow As Long, i As Long, j As Integer
lstrow = Range("A" & Sheets("Sheet1").Rows.Count).End(xlUp).Row
j = 0
For i = 2 To lstrow
curvalue = Range("A" & i).Value
If curvalue = prevalue And Range("A" & i).Offset(0, 2).Value = "*" Then
j = j + 1
Range("A" & i).Offset(0, 1).Value = j
ElseIf curvalue <> prevalue And Range("A" & i).Offset(0, 2).Value = "*" Then
j = 1
Range("A" & i).Offset(0, 1).Value = j
End If
prevalue = curvalue
Next i
End Sub