Consulting

Results 1 to 4 of 4

Thread: Response Time UDF needs to be modified

  1. #1

    Response Time UDF needs to be modified

    Hi VBAXians,

    i need help in modifying a custom function.

    here i have
    [VBA]
    Function RTTAIL(Group As Range, RT As Range) As String
    If IsEmpty(RT) Then RTTAIL = "Blank data": Exit Function
    Select Case Group.Value
    Case "SFIDA", "MALTA", "DP180F": Limit = 2
    Case "DC12", "FUJHIN", "OLYMPIA", "XES PSG": Limit = 4
    Case Else: RTTAIL = Empty: Exit Function
    End Select
    If RT.Value > Limit Then RTTAIL = "Tail" Else RTTAIL = "Not a Tail"
    End Function
    [/VBA]

    i am calculating response time for each group based on limits assigned to them. Now my requirement is, i need to get result as RT not Met if the RT.value is greater than Limit but less than 1.5 times of Limit. And should get RT Tail if RT.value is greater than 1.5 times of Limit.

    example : if my RT.value is 2.5 then it is greater than Limit but less than 1.5 times of Limit ( Limit x 1.5 times = 2 x 1.5 = 3 ) so i should get RT Not Met. this logic goes for each case in select case.

    not knowing how to modify the function please help
    raj

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That is about as clear as the mud surrounding us in these waterlogged days.

    ANd nowhere do I see Limit being assigned a value.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    I am attaching a sample workbook here
    to make things clear

  4. #4
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,729
    Location
    I don't see Limit DIMed anywhere so I put it in the Sub. Some logic like this might help.

    The case where the value is < LIMIT did not seem to be addressed
    [vba]
    Option Explicit
    Function RTTAIL(Group As Range, RT As Range) As String
    Dim Limit As Long

    If IsEmpty(RT) Then
    RTTAIL = "Blank data"
    Exit Function
    End If
    Select Case Group.Value
    Case "SFIDA", "MALTA", "DP180F"
    Limit = 2
    Case "DC12", "FUJHIN", "OLYMPIA", "XES PSG"
    Limit = 4
    Case Else
    RTTAIL = Empty
    Exit Function
    End Select
    If (RT.Value <= Limit) Then
    RTTAIL = "RT Not Met"
    ElseIf (RT.Value < 1.5 * Limit) Then
    RTTAIL = "RT Not Met"
    Else
    RTTAIL = "Not a Tail"
    End If
    End Function
    [/vba]


    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •