Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function CalcTarget1(range_data As Range, other_range As Range, weeksOut As Integer)
- Dim cell As Range
- Dim col As Range
- Dim c As Range
- Dim count As Double
- Dim sum As Double
- Dim box As Double
- For Each cell In range_data
- If cell.Style = "Style 1" Then
- count = count + 1
- End If
- Next cell
- If count > 0 Then
- sum = 100 / count
- Else
- sum = 0
- End If
- For Each col In range_data
- If col.Value > weeksOut Then
- For Each c In other_range
- If c.Style = "Style 1" Then
- box = box + 1
- End If
- Next c
- End If
- Next col
- CalcTarget1 = Round(sum, 1) * box & "%"
- End Function
Add Comment
Please, Sign In to add comment