This is my first attempt at using VB in excel so bear with me.
I have a column of names where there are multiple duplicates of each, then in another column is the hours that each person as spent on a particular project. What my function does is goes down the list of names and each time it finds a match with $name it adds the corresponding hours up then returns the total.
Now this works when the table I'm getting the input from is on the same sheet as I'm using the Function, however I want to have the results on a separate sheet from the table. I believe its an issue with how its referencing the cell in line 10 but I'm not sure how to resolve this.
Function Hours(start as Range, finish As Range, name As String) As Double
Hours = 0#
RowStart = start.Row
RowFinish = finish.Row
NameColumn = start.Column
HourColumn = finish.Column
For i = RowStart To RowFinish
If Cells(i, NameColumn) = name Then Hours = Hours + Cells(i, HourColumn).Value
Next i
End Function