JustGANDES
New Member
- Joined
- Feb 11, 2014
- Messages
- 6
Hi there,
I'm working on a spreadsheet that I didn't create and wanted to understand how the macro works on the spreadsheet. Some of the language in the macro makes sense to me, but the majority of it doesn't. Would it be possible for someone to look over this and in each section, let me know what it means (what the function is?). Any information you can provide would be GREATLY appreciated!!! Thank you so much!
Function utilisation(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates utilisation or agent occupancy
On Error GoTo utilisationerror
utilisation = Intensity / agents
utilisationexit:
If utilisation < 0 Then utilisation = 0
If utilisation > 1 Then utilisation = 1
Exit Function
utilisationerror:
utilisation = 0
Resume utilisationexit
End Function
-------------------------------------------------------------------------------------------------------------------
Function top(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'top row of Erlang-C Formula
top = (Intensity ^ agents) / Application.WorksheetFunction.Fact(agents)
End Function
------------------------------------------------------------------------------------------------------------------
Function erlangBR(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates summed factorial element of Erlang-C formula
Dim k As Long, max As Long, answer As Double
k = 0
max = agents - 1
answer = 0
For k = 0 To max
answer = answer + ((Intensity ^ k) / Application.WorksheetFunction.Fact(k))
Next k
erlangBR = answer
End Function
-----------------------------------------------------------------------------------------------------------------------
Function ErlangC(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'Brings together elements of Erlang C formula Top, Utilisation and ErlangBR
On Error GoTo ErlangCError
ErlangC = (top(Intensity, agents)) / ((top(Intensity, agents)) + ((1 - utilisation(Intensity, agents)) * erlangBR(Intensity, agents)))
ErlangCExit:
If ErlangC < 0 Then ErlangC = 0
If ErlangC > 1 Then ErlangC = 1
Exit Function
ErlangCError:
Resume ErlangCExit
End Function
-----------------------------------------------------------------------------------------------------------------------
Function Servicelevel(Intensity As Double, agents As Long, target As Double, duration As Double) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculation of service level
On Error GoTo servicelevelerror
Servicelevel = 1 - (ErlangC(Intensity, agents) * Exp(-(agents - Intensity) * target / duration))
Servicelevelexit:
If Servicelevel > 1 Then Servicelevel = 1
If Servicelevel < 0 Then Servicelevel = 0
Exit Function
servicelevelerror:
Servicelevel = 0
Resume Servicelevelexit
End Function
------------------------------------------------------------------------------------------------------------------------
Function agentno(Intensity As Double, target As Double, duration As Double, servreq As Double) As Long
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates minimum agent numbers for required service level
Dim agents As Long, minagents As Long
minagents = Int(Intensity)
agents = minagents
While Servicelevel(Intensity, agents, target, duration) < servreq
agents = agents + 1
Wend
agentno = agents
End Function
----------------------------
I'm working on a spreadsheet that I didn't create and wanted to understand how the macro works on the spreadsheet. Some of the language in the macro makes sense to me, but the majority of it doesn't. Would it be possible for someone to look over this and in each section, let me know what it means (what the function is?). Any information you can provide would be GREATLY appreciated!!! Thank you so much!
Function utilisation(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates utilisation or agent occupancy
On Error GoTo utilisationerror
utilisation = Intensity / agents
utilisationexit:
If utilisation < 0 Then utilisation = 0
If utilisation > 1 Then utilisation = 1
Exit Function
utilisationerror:
utilisation = 0
Resume utilisationexit
End Function
-------------------------------------------------------------------------------------------------------------------
Function top(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'top row of Erlang-C Formula
top = (Intensity ^ agents) / Application.WorksheetFunction.Fact(agents)
End Function
------------------------------------------------------------------------------------------------------------------
Function erlangBR(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates summed factorial element of Erlang-C formula
Dim k As Long, max As Long, answer As Double
k = 0
max = agents - 1
answer = 0
For k = 0 To max
answer = answer + ((Intensity ^ k) / Application.WorksheetFunction.Fact(k))
Next k
erlangBR = answer
End Function
-----------------------------------------------------------------------------------------------------------------------
Function ErlangC(Intensity As Double, agents As Long) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'Brings together elements of Erlang C formula Top, Utilisation and ErlangBR
On Error GoTo ErlangCError
ErlangC = (top(Intensity, agents)) / ((top(Intensity, agents)) + ((1 - utilisation(Intensity, agents)) * erlangBR(Intensity, agents)))
ErlangCExit:
If ErlangC < 0 Then ErlangC = 0
If ErlangC > 1 Then ErlangC = 1
Exit Function
ErlangCError:
Resume ErlangCExit
End Function
-----------------------------------------------------------------------------------------------------------------------
Function Servicelevel(Intensity As Double, agents As Long, target As Double, duration As Double) As Double
'Copyright Expedio Virtual Assistance Ltd 2008
'calculation of service level
On Error GoTo servicelevelerror
Servicelevel = 1 - (ErlangC(Intensity, agents) * Exp(-(agents - Intensity) * target / duration))
Servicelevelexit:
If Servicelevel > 1 Then Servicelevel = 1
If Servicelevel < 0 Then Servicelevel = 0
Exit Function
servicelevelerror:
Servicelevel = 0
Resume Servicelevelexit
End Function
------------------------------------------------------------------------------------------------------------------------
Function agentno(Intensity As Double, target As Double, duration As Double, servreq As Double) As Long
'Copyright Expedio Virtual Assistance Ltd 2008
'calculates minimum agent numbers for required service level
Dim agents As Long, minagents As Long
minagents = Int(Intensity)
agents = minagents
While Servicelevel(Intensity, agents, target, duration) < servreq
agents = agents + 1
Wend
agentno = agents
End Function
----------------------------