View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach[_2_] Otto Moehrbach[_2_] is offline
external usenet poster
 
Posts: 1,071
Default assign occurence number

To do chronological counting like you want, you will need VBA. Right-click
your sheet tab, select View Code, and paste this macro into that module.
"X" out of the module to return to your sheet. HTH Otto

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("B1:B20")) Is Nothing Then
Target.Offset(, 1) = _
Application.CountIf(Range("B1:B20"), 1)
End If
End Sub

"omega" wrote in message
...
Hi,
How do you assign an occurrence number in a cell?
Let's say Column B (B1:B20).
Restriction: 1 is the only valid data to be entered in Column B.

Usage possibilities:
If the user enters "1" at B3, an occurrence number of "1" appears at C3.
If the user enters "1" at B12, an occurrence number of "2" appears at C12.
If the user enters "1" at B1, an occurrence number of "3" appears at C1.
If the user enters "1" at B20, an occurrence number of "4" appears at C20.
And so on.

Objective: Chronological cell usage indicator.
The occurrence number will be used by another sheet.

I'm still new to excel so please indicate extra details needed for
beginners
like me.

Thank you,

Omega