formula for days between completed meetings

C

cm

Here's the deal. I have 10 meeting dates (some may be blank) and 10 columns
beside each that are either blank (meaning completed) or have the word
'Missed', as such:

A B C D E
1/2/09 (blank) 1/4/09 Missed 1/5/09 (blank) etc etc

Too many to use nested IFs.

I have been asked to calculate the average days between non-missed meetings.
Some of the meeting date cells will be blank. I would appreciate any advice.
 
C

cm

end date would be the last date that is filled in. so if the person had 10
meetings scheduled, all 10 would have a value. if the person had only 4
meetings scheduled, there would only be 4 values.
 
M

muddan madhu

use this User Defined Function

right click on sheet name, click view code, insert module paste the
below code,
Go to excel sheet put formula as =Avg(A1:K1)

Let me know errors, if any

Function Avg(Inputvalue As Range)
Dim cell As Range
For Each cell In Inputvalue
If cell.Value = "missed" Then
result = cell.Offset(0, -1).Value + result
counter = counter + 1
End If
Next cell
With Application.WorksheetFunction
X = .Count(Inputvalue)
y = .Sum(Inputvalue)
Z = y - output
z1 = X - counter
End With
Avg = Z / z1
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top