View Single Post
  #10   Report Post  
Niek Otten
 
Posts: n/a
Default Difficult function: help needed.

Paste this function:

Function OntslagVergoedingsFactor(age As Long, years As Long)
Dim Years51 As Long
Dim Years41 As Long
Years51 = Application.WorksheetFunction.Min(years,
Application.WorksheetFunction.Max(0, age - 51))
Years41 = Application.WorksheetFunction.Min(years,
Application.WorksheetFunction.Max(0, age - 41))
OntslagVergoedingsFactor = years + Years41 * 0.5 + Years51 * 0.5
End Function


--
Kind regards,

Niek Otten

"topola" wrote in message
oups.com...
To be able to use this function easily in each case paste this command
into a Visual Basic Project, Macro Module:

Function Factor(Years)
If Years 51 Then
Factor = 2
ElseIf Years 41 Then
Factor = 1.5
Else
Factor = 1
End If
End Function

Therafter you will find this function in Insert Function User
Defined Functions

Alternatively you can use a function in cell:
=IF(A451,2,IF(A441,1.5,1))


Tomek Polak
www.vba.blog.onet.pl