title: Counting Numerator and denominator for semi-annual time period
body: <p>Hi I have a ocde written for calculating quartely rates. To calculate quarter from the date, I have "YYYYq" in the code. Can anyone help with replacing quarter with semiannual time period. I have tried "YYYY/2" but this didint wowrk. I also tried using "YYYYmm" but that didnt work either.</p>
  
  <p>I want to have numerators and denominators for semiannual period. For eg: if a visit date was 1/1/2012, then this will be counted in first half of the year. All vists dates from 1/1/2012 - 06/30/2012 will get couonted in the first semiannual period and from 6/30/2012 - 12/31/2012 will be counted in second semiannual time period.</p>
  
  <p>Thanks so much for your time and suggestions.</p>
  
  <pre><code>   Function Visits(target_timeframe)
  
          Target_Quarter = Format(target_timeframe, "YYYYq")
  
          For vRow = 2 To 2000
  
              entered_timeframe = Format(Sheets("sheet1").Range("A" &amp; vRow).Value, "YYYYq")
  
              Entered_Visits = Sheets("sheet1").Range("B" &amp; vRow).Value 'equals value of column
  
              If (entered_timeframe = Target_Quarter) Then
                  denominator = denominator + 1
                  If (Entered_Visits &gt; 0) Then
                      numerator = numerator + 1
                  End If
              End If
          Next
  
          If denominator &gt; 0 Then
              Average = numerator / denominator
          Else
              Average = "N/A"
          End If
  
      End Function
  </code></pre>